Need help figuring out why I can't connect to MySQL
If this isn't the right forum for it, I'd appreciate if an admin could move this.
I recently installed the latest WAMPserver onto my work laptop, got it up, and tried to start developing. I can connect to MySQL through the phpMyAdmin that comes with the server, but when I try to connect through my code, it fails.
I've tried connecting both through PHP's PDO as well as through mysql_connect, and in both cases, it says access denied for the user. I've tried removing the password, putting it back simpler, etc, and nothing seems to change. I have no idea how to diagnose where the issue is. Can someone lend a hand?
Okay in the phpmyadmin directory on your pc look for a file called config.inc.php, open it in notepad or editor of your choice. This should at least have your username in it. As for the password there is a way to reset it. You can run this query in phpmyadmin
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES;
||||If you are getting paid to do a job, don't ask for help on it!||||
So this morning, for whatever reason, root with no password worked, so I tried changing the host of my user from '%' to 'localhost', and it worked. I have no idea why it previously failed, or what about it is different. In fact, at home I'm using an older version of WAMP (thusly an older version of PHP/MySQL) in which I use '%' for local users with no problem.
Anyway, thanks for helping point me in the right direction.
One more thing, on a slightly related note... I remember when I first tried using WAMP2, I believe had the issue of password that was too long. Do you happen to know how I can check what the max length of a password is, and how to change that?