Jump to content



  • Please log in to reply
2 replies to this topic

#1 dagoodgames

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 March 2006 - 09:13 PM


I'm trying to connect to a mySQL database with PHP. I'm trying to use the mysql command, but I get the following message:

Warning: mysql_connect(): Access denied for user 'dagoodgamer'@'localhost' (using password: YES) in /home/dagoodga/...etc.

Does this message mean I have the wrong username and/or password? If so, could someone explain the proper way to use the mysql_connect command? I'm not very familiar with it. Is the following the correct usage:

$db = mysql_connect("localhost", "username", "password");

(where you replace "username" and "password" with your username and password?)



#2 AV1611

  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 16 March 2006 - 09:21 PM

you need to make sure you have access two different ways:

First, the user/login needs to be correct
second, the login source needs to be valid

for example, you might be able to login as ROOT/PASSWORD from LOCALHOST, but not as ROOT/PASSWORD from

I you want to only allow local access, localhost is appropriate, but if you want to login from other locations, you might specify the IP in your settings, or you could specify % by BE CAREFULL doing that...

Here is how I connect...
$database = "blah";

#3 dagoodgames

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 March 2006 - 09:48 PM

Thank you! That worked! And I found out right before reading your post that I had the wrong username. But now I've got logged on.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users