mysqlnd无法使用旧的不安全身份验证连接到MySQL 4.1+

时间:2011-08-12 16:25:08

标签: php mysql

我遇到从PHP 5.3.5(WAMP安装)连接到MySQL 5.5.8的问题。我收到以下错误:

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

我已经尝试了我可以在网上找到的所有建议,包括Stack Overflow中的一些建议和这一个:http://engin.bzzzt.biz/2010/11/12/php-mysql-insecure-authentication/

我检查了我的设置,旧密码标志已关闭。我已将密码更新为新密码哈希并验证哈希是用户表中的41个字符和刷新的权限。出于某种原因,我仍然得到错误。有人有什么想法吗?

更新:我正在使用ZenCart。这是我正在建立连接的行以及抛出错误的位置:

$this->link = @mysql_connect($zf_host, $zf_user, $zf_password, true) or die (mysql_error());

2 个答案:

答案 0 :(得分:3)

使用有问题的用户通过客户端连接到MySQL,执行以下命令:

SET old_passwords=0;
SET password=PASSWORD('your current password');

答案 1 :(得分:0)

想出来!是我的疏忽。显然,在ZenCart中有2个文件,您必须设置数据库配置。一个用于目录,一个用于管理区域。对我来说没有多大意义,因为它们都连接到同一个DB。也许它与能够将一个db用户用于目录而一个用于管理员出于安全原因有关。我只是设置了一个本地副本并更改了其中一个配置文件而没有更改另一个。导致问题的文件仍指向我的生产数据库。知道它必须简单!

相关问题