BLOG
Enjoy when you can, and endure when you must.
DEC 06, 2012/后端开发与架构
解决PHP5.3连接MySQL4.1+提示不安全的认证

今天升级了PHP5.3,在连接MySQL数据库时发生错误,日志记录如下:

   mysqli::mysqli(): (HY000/2000): 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.其实错误记录已经指示了问题解决的办法,具体操作过程如下:

   登录MySQL并在命令符下输入如下命令:

UPDATE mysql.user SET Password=PASSWORD('password')WHERE User='user'limit1;
FLUSH PRIVILEGES;

测试此时的密码是否为41位,如果是则问题应该解决了。

COMMENTS
LEAVE COMMNT