1

When i try to connect a remote mysql server from my localhost i get this error:

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

Any idea why it gives this error?

1

3 Answers 3

4

It gives this error because your MySQL server uses the old way of storing password -- and not the new way, which is more secure.

The mysqlnd driver, which has been introduced with PHP 5.3, doesn't support the old authentication way.

So, you have to modify your MySQL configuration, to use the new, more secure way.
The error message you get is indicating you how to do that.

Sign up to request clarification or add additional context in comments.

Comments

1

this helped me

http://www.phpro.org/articles/Database-Connection-Failed-Mysqlnd-Cannot-Connect-To-MySQL.html

quick fix

as db user

SET SESSION old_passwords=0; 
SET PASSWORD=PASSWORD('my_password');

as admin

FLUSH PRIVILEGES;

real fix

open up your my.conf file and comment out the following line

old_passwords=1

Restart MySQL. this will ensure MySQL never uses the old passwords again.

as db user

SET PASSWORD=PASSWORD('my_password');

as admin

FLUSH PRIVILEGES;

Comments

0

It seems to be an issue when running PHP <=5.2 code in PHP 5.3+: http://forums.mysql.com/read.php?52,403493,411125#msg-411125

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.