8.0.34-0 ubuntu 安装Mysql 后无法链接是什么情况

检查日志解决办法

检查日志

如果检查一下帐号密码没问题看一下日志:

Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'

很显然是mysql 采用的密码插件出了问题:你采用了mysql废弃的密码验证方式: Plugin mysql_native_password reported: ‘mysql_native_password’ is deprecated and will be removed in a future release. Please use caching_sha2_password instead

解决办法

这时候你可以通过SQL来更新认证模式和密码:

update user set plugin = 'caching_sha2_password' where user = '用户名';

操作之前先选择mysql库 对于PHP来说,使用7.1(7.1.16之前的版本)或者7.2(7.2.4之前的版本),仍需要将MySQL服务器的默认密码插件设置为mysql_native_password,不然无法正常连接到MySQL。

好文阅读

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。