Support Forums
Could not connect: Access denied for user 'root'@'localhost' - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: Could not connect: Access denied for user 'root'@'localhost' (/showthread.php?tid=15995)



Could not connect: Access denied for user 'root'@'localhost' - nevets04 - 02-03-2011

Quote:Could not connect: Access denied for user 'root'@'localhost' (using password: YES)

This error is from

Code:
mysql_connect("localhost", "root", "dog")

I'm not using the password "YES". Anyone know what's up?

This is from the config.inc.php

Code:
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'dog';
$cfg['Servers'][$i]['AllowNoPassword'] = true;



RE: Could not connect: Access denied for user 'root'@'localhost' - Omniscient - 02-03-2011

Try 127.0.0.1

And your password might be wrong.


RE: Could not connect: Access denied for user 'root'@'localhost' - nevets04 - 02-03-2011

(02-03-2011, 03:22 PM)Omniscient Wrote: Try 127.0.0.1

And your password might be wrong.

I tried 127.0.0.1 and got the same error. How would my password be wrong if in my config file it says that it is dog?


RE: Could not connect: Access denied for user 'root'@'localhost' - Gaijin - 02-03-2011

If you could post the part of the code which is connecting to the database, it could be something wrong in that code.
Are you using a already written code, or are you writting the code?
Just a thought, but are you sure that the database has a password!


RE: Could not connect: Access denied for user 'root'@'localhost' - nevets04 - 02-03-2011

(02-03-2011, 04:16 PM)Gaijin Wrote: If you could post the part of the code which is connecting to the database, it could be something wrong in that code.
Are you using a already written code, or are you writting the code?
Just a thought, but are you sure that the database has a password!

Yep, it doesn't have a password. Thanks


RE: Could not connect: Access denied for user 'root'@'localhost' - Gaijin - 02-03-2011

(02-03-2011, 04:47 PM)nevets04 Wrote: Yep, it doesn't have a password. Thanks
Glad I could Help! ;)

I did the same mistake couple of times when I started with MySQL.... Big Grin