mysql_connect(): The server requested authentication method unknown to the client [mysql_old_password] in

Solution 1:

Try reading this: link

MySQL introduced longer password hashes in (i think) version 4.1, and your server probably still uses them (check for 16 byte password hashes in your mysql user table). Newer versions use longer password hashes. Your server supports both, but your client (php) seems to support only new ones in this version (and on).

If it's possible, use the solution from the link in the first line, and set your password again with the new hash, but beware, if you're using any other (old) clients which rely on old passwords, compatibility might break. Also try looking for old-password support for MySQL in PHP, but i'm not sure about it.

Solution 2:

ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';

Solution 3:

I know this is an old topic, but I worked around the issue, without having to upgrade/downgrade anything. Basically I commented out the old_passwords=1 line in my my.cnf file, restarted mysql, added/modified the user which eventually got the 16 byte hash, then I went back and uncommented the old_passwords=1 line, and restarted mysql. So basically:

So there you have it: 1 user using new password type, while other users have their old password types. And everybody can log in! ;)

Tags:

Php