沉睡个人博客
沉睡个人博客
博客
工具箱
留言板
沉睡个人博客
博客
工具箱
首页
后端
【PHP】php7链接数据库报错The server requested authentication method unknown to the client
【PHP】php7链接数据库报错The server requested authentication method unknown to the client
1,810人已阅读
时间:2022-03-19 00:00:00
### php7链接数据库报错The server requested authentication method unknown to the client 主要原因 是因为 mysql 8.0 升级了密码的验证方式 caching_sha2_password, 之前一直是mysql_native_password方式 解决办法: 1.找到mysql的配置文件my.cnf,我的配置文件位置在 /usr/local/etc/my.cnf (请自行找到自己的电脑的配置文件地址)。 2.在 [mysqld]下加入 default-authentication-plugin=mysql_native_password 一行 3.重启mysql(我的重启命令为mysql.server restart) 4.进入mysql 修改登入mysql用户的登录验证方式 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; 5.重新回到php尝试连接mysql
上一篇:【jquery】for循环中嵌套异步请求导致顺序错乱
下一篇:【VUE】vue-quill-editor 获取无法获取光标位置