Cannot connect to MySQL 4.1+ using old authentication

Q:

同一项目组,其他人可以连接测试服务器mysql数据库,而我的一直报错,连接错误。

错误信息:“Cannot connect to MySQL 4.1+ using old authentication”!

 

 

A:

First check with the SQL query

SHOW VARIABLES LIKE 'old_passwords'

(in the MySQL command line client, HeidiSQL or whatever frontend you like) whether the server is set to use the old password schema by default. If this returns old_passwords,Off you just happen to have old password entries in the users tables. The MySQL will use the old authentication routine for these accounts. But you can simply set a new password for the account and the new routine will be used.
You can check which routine will be used by taking a look at the mysql.users table (with an account that has access to that table)

SELECT `User`, `Host`, Length(`Password`) FROM mysql.user

This will return 16 for accounts with old passwords and 41 for accounts with new passwords (and 0 for accounts with no password at all, you might want to take care of those as well).
Either use the user managements tools of the MySQL front end (if there are any) or

SET PASSWORD FOR 'User'@'Host'=PASSWORD('yourpassword');
FLUSH Privileges

(replace User and Host with the values you' got from the previous query). Then check the length of the password again. It should be 41 now and mysqlnd should be able to connect to the server.

 

问题解决,特此记录一下。

 

你可能感兴趣的:(Cannot connect to MySQL 4.1+ using old authentication)