MySQL数据库中因使用旧的加密方式无法远程连接的问题

使用PHP连接时出现的错误信息:

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

SHOW VARIABLES;

如果old_passwords = 1,需要手工修改用户的密码如下:

SET old_passwords = 0;
UPDATE mysql.user SET Password = PASSWORD('my_password') WHERE User = 'my_username' limit 1;
SELECT LENGTH(Password) FROM mysql.user WHERE User = 'my_username';
FLUSH PRIVILEGES;

你可能感兴趣的:(MySQL数据库中因使用旧的加密方式无法远程连接的问题)