阿里云服务器618活动(全网最低价)—1核2G3年169元(不限CPU性能)【立即抢购】

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

210次阅读
没有评论

客户网站出现问题,错误信息如下:

Warning: mysql_connect(): 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 in /www/wwwroot/jieshunhg.com/includes/mysql.class.php on line 31

Fatal error: Uncaught exception 'Exception' with message '连接失败' in /www/wwwroot/jieshunhg.com/includes/mysql.class.php:33 Stack trace: #0 /www/wwwroot/jieshunhg.com/includes/mysql.class.php(13): mysql->connect('sdm35976894.my3...', 'sdm35976894', 'sdm35976894abc') #1 /www/wwwroot/jieshunhg.com/includes/mysql.class.php(24): mysql->__construct() #2 /www/wwwroot/jieshunhg.com/model/Model.class.php(14): mysql::getIns() #3 /www/wwwroot/jieshunhg.com/includes/init.php(9): Model->__construct() #4 /www/wwwroot/jieshunhg.com/index.php(3): require('/www/wwwroot/ji...') #5 {main} thrown in /www/wwwroot/jieshunhg.com/includes/mysql.class.php on line 33

解决方法:

https://bbs.csdn.net/topics/390702764

mysql>UPDATE mysql.user SET Password = PASSWORD('demo') WHERE user = 'demo';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0
mysql> select user,length(password) from mysql.user;
+--------------+------------------+
| user         | length(password) |
+--------------+------------------+
| demo         |               41 | 
| demo         |               41 | 
+--------------+------------------+
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

修改完密码后,还需要在配置文件中修改下old_passwords选项。把值设置为0。即,
old_passwords=0
然后重启mysql。

SET SESSION-old passwords = FALSE;
arison
版权声明:本站原创文章,由arison2021-07-31发表,共计1968字。
转载提示:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)