|-转 php连接mysql报错The server requested authentication method unknown to the client
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;FLUSH PRIVILEGES;
无效后再在MySql配置文件里修改default_authentication_plugin=mysql_native_password
php7.0连接mysql8.0报错:The server requested authentication method unknown to the client
是因为mysql80使用了新的密码验证插件:caching_sha2_password,而在php7.0并不支持这种方式。
解决办法:
1.升级php
2.修改mysql的配置文件,my.ini
找到mysqlId下的default-authentication-plugin配置项修改其值为mysql_native_password
default_authentication_plugin=mysql_native_password
重启mysql
然后在win+r输入cmd进入命令行模式
cd D:\Dsware\mysql\bin (把MySQL安装的路径输入);
再mysql -u root -p回车,输入密码:...
浏览更多内容请先登录。
立即注册
更新于:2021-12-11 18:21:12
相关内容
Centos7利用yum安装apache+mysql8+php7 一篇搞定!
PHP错误:SQLSTATE[HY000] [2054] The server requested authentica...
Centos中查看nginx、apache、php、mysql配置文件路径
php报错 Error: Variable 'sql_mode' can't be set to the value of 'M...
PHP报错:Constants may only evaluate to scalar values
推荐内容