authenticationstring mysql_docker mysql authentication_string client does not support authentication...

docker安装mysql后,本地navicat连接报错client does not support authentication

解决办法:

1. docker ps -a 查找到容器id

2. docker exec -it id /bin/bash 进入mysql容器

3.mysql -u root -proot登陆mysql

此处比较奇怪,我在docker中启动mysql容器指定密码是123456但是123456登陆不了,使用密码root可以登陆

4.use mysql; 进入mysql

5.查询用户表信息:

select host,user,authentication_string from user ;

6.更改host为% user为root的用户的authentication_string

host为%大家可以百度一下,说是方便远程连接

update user set authentication_string = 'root' where user = 'root' and host = '%';

update user set authentication_string = 'root' where user = 'root' and host = 'localhost';

7.如果还不行使用下面语句:

alter user 'root'@'localhost' identified with mysql_native_password by '123456';

alter user 'root'@'%' identified with mysql_native_password by '123456';

然后navicat登陆就成功啦

9387b104f3474da3caeb2ee727a9c997.png

fe539c0f8faa27fa8f7dfc37cc29c638.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值