mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication

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. SQL 错误代码: “7335941”.

是采用兼容格式的密码,而 php5.3的php_mysql; php_pdo_mysql 采用的是增强的密码,所以导致两者不匹配,最方便的方式还是更新db的设置,取消 old_passwords
然后在 mysql.mysql.user,更新所有用户的密码, 如:

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

但是对于我们这种小站站长来说,这些什么改这改那都不能用啊,更不用说联系空间服务商升级数据库了。


其实这个问题的解决办法很简单。一般情况下,虚拟的空间服务商的数据库都提供了phpMyAdmin的MySQL数据库管理工具,所以我们只要在phpMyAdmin中运行下面的两句SQL语句就行了。


SET-SESSION-old_passwords-=-FALSE;

SET-PASSWORD-=-PASSWORD('your-existing-password-in-plain-text');



你可能感兴趣的:(mysql)