【已解决】SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication.

买的是别人公司的虚拟主机,在控制面板上把php版本由php5.2切换到7.1(据说PHP7性能高),切换后,只有首页可以打卡,内页提示数据库执行错误(打印的debug信息如下):

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

百度了一下发现是mysql高版本驱动对mysql低版本的不太支持,低版本数据库密码模式为16位,高版本密码模式是41位,如果方便的话,让客户去修改再好不过了。

我是自己打开phpmyadmin工具,执行下面两个SQL修改的.

SET SESSION old_passwords = FALSE;
SET PASSWORD = PASSWORD(‘这个括号里是密码‘);

这样修改一下就行了。也不用重启mysql,刷新一下页面OK啦。

 

参考:https://blog.csdn.net/aerchi/article/details/45949937

 

【已解决】SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication.

上一篇:理解C#系列 / 核心C# / 变量


下一篇:mysql索引和索引的原理