I have a dedicated server which has been setup and running well for some time now with the following. Let’s call this server 1.
MySQL 5.0.95
PHP 5.2.17
Creating connections to the database from PHP is running okay using this method:
mysql_connect($IPAddress,$DBUser,$DBPassword);
@mysql_select_db($database) or die( "Unable to select database");
Now I also have a second dedicated server, let’s call this server 2, which connects to the database on the above server, until today it was working fine. What I did was update PHP to version 5.3.19 and now the error I receive is:
Could not connect: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD(‘your_existing_password’). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file
I’ve tried running the SET PASSWORD command and it still doesn’t work. I’ve also tried setting old-passwords flag to 0 and that doesn’t work either.
Am I missing something? All works fine on server 1, it’s just server 2 that doesn’t work.
Remove or comment out the following line in the file “my.cnf” (e.g. /etc/my.cnf):
This will stop MySQL from using the old passwords, right now I am betting that if you ran the query –
SELECT user, Length(Password) FROM mysql.user;– you would see that your username probably has two entries, a 16 character and a 41 (41 being the querySET PASSWORDyou recently ran.)After
old_passwordshave been removed / commented out then you need to restart MySQL or it will keep using the old_passwordsOnce MySQL has restarted then you may need to run the following queries again:
&