Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Feb 06, 2009 8:40 am 
Offline
Newbie

Joined: Fri Feb 06, 2009 8:35 am
Posts: 3
Hi,

JUst installed LAMP on openSUSE. They all seem to be working well individuallu.
However, after i created a database, i created a PHP file to connect to it using

Quote:
<?
$username="username;
$password="password";
$database="username-database";
?>

i get the error:

Quote:
Not connected : Access denied for user 'wwwrun'@'localhost' (using password: NO)


I have no idea who - wwwrun is. I created the database under the default root user. I created another user and gave all access priviledges, and i still get the same error - so ive ruled out username/password problem.

Anyone know what the problem might be please?


Last edited by d_quixote on Fri Feb 06, 2009 9:01 am, edited 2 times in total.

Top
   
 Post subject:
PostPosted: Fri Feb 06, 2009 8:46 am 
Offline
Senior Newbie

Joined: Thu Oct 09, 2008 10:21 am
Posts: 8
Those are just vars (and it looks like the one for host is missing); what are you actually passing to mysql_connect, or whatever db package you're using?

See this page from the php manual: http://us.php.net/mysql_connect

FWIW, though, sounds like wwwrun may be the user that php is running under via your http server.


Top
   
 Post subject: Thanks
PostPosted: Fri Feb 06, 2009 9:00 am 
Offline
Newbie

Joined: Fri Feb 06, 2009 8:35 am
Posts: 3
Passing this?

Quote:
// Opens a connection to a MySQL server
$connection = mysql_connect ("localhost", $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());
}



But why/ how is it using that user? I didn't create it. How can i change it?


Top
   
 Post subject:
PostPosted: Sat Feb 07, 2009 12:43 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
In the example text in your first post, you are missing the double-quote mark at the end of your username. If your PHP script is the same way, this would likely cause it to fail.

Looks like in SUSE that Apache runs as the wwwrun user, which presumably is the username that PHP tries to use for the MySQL connection if a username isn't provided.

Try putting the following before the line with mysql_connect():
Code:
error_log( "Connecting to MySQL with username: " . var_dump($username) . " , password: " . var_dump($password) . " , database: " . var_dump($database) );

and check your error log to see what you get for the variables.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group