中标鲲鹏系统通过docker安装的mysql(系统架构为arm64),按照安装脚本安装之后,用navicat连接遇到的问题及解决如下

问题 CHost ‘172.17.0.1’ is not allowed to connect to this MySQL server

解决:

  • 进入容器内部
docker exec -it mysql bash
  • 登录到mysql
mysql -u root -p
  • 查询root用户信息
use mysql;
select host from user where user='root';

在这里插入图片描述

  • 修改帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入MySQL后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从"localhost"改称"%"
update user set host = '%' where user ='root';
  • 刷新配置
flush privileges;

问题 caching_sha2_password2#08S01Got timeout reading communication packets

从8.0.11版本起,不再像mysql5.7及以前版本那样,设置用户密码时默认的验证方式为caching_sha2_password,用下面的命令设置成mysql5.7及以前版本的密码验证方式

use mysql;
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘密码’;
FLUSH PRIVILEGES;

参考文献 https://blog.csdn.net/litte_frog/article/details/80874105

Logo

鲲鹏展翅 立根铸魂 深耕行业数字化

更多推荐