出现的问题:
新建帐户read,在phpadmin无法登录
但使用root用户可以正常登录
![](https://img.haomeiwen.com/i15240512/5045b7a3bc5adc79.png)
我的php也受到了影响
![](https://img.haomeiwen.com/i15240512/1c43b4ff10b965da.png)
最后得出的结论是:
由于我的php7.3.10不支持caching_sha2_password
图中没有看到caching_sha2_password
![](https://img.haomeiwen.com/i15240512/30639a3549cc7f2c.png)
而mysql8.0.17的密码验证方式是caching_sha2_password
![](https://img.haomeiwen.com/i15240512/a6725892e9aec945.png)
所以,只能去修改配置文件了。。。C:\AppServ\MySQL\mysql.ini
添加default_authentication_plugin=mysql_native_password
![](https://img.haomeiwen.com/i15240512/7acf3e26e24f2cf5.png)
然后重启mysql
![](https://img.haomeiwen.com/i15240512/f579c26eac544800.png)
最后修改read帐户的登录验证方式
ALTER USER 'read'@'%' identified with mysql_native_password BY '87654321';
![](https://img.haomeiwen.com/i15240512/e37cb4c7fde8fe71.png)
正常登录!
![](https://img.haomeiwen.com/i15240512/6d870d2f9a221e2b.png)
总结:
后面需要新建帐户的时候,要加上mysql_native_password 来指定验证方式
create user 'root'@'localhost' identified with mysql_native_password by '12345678';
网友评论