Hello World

Just So So ...

mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication解决方法

PHP MySQL 0 评

使用PHP5.3+的mysqli连接MySQL的时候,报错:

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

此报错的原因是:PHP5.3+的php_mysql、php_pdo_mysql采用的是增强的密码存储格式(即新的14位的存储格式)。而MySQL服务端所采用的还是旧的16位的存储格式。
PHP5.2版本不会报这个错误

解决方法:

  1. 切换PHP版本至5.2

2.
Step1:修改配置文件中的old_password选项,设置为0.即

old_password=0

Step2:修改mysql库表的user表数据

UPDATE mysql.user SET Password = PASSWORD('demo') WHERE user = 'demo';

重启MySQL

发表评论
撰写评论