Solution: Cannot connect to mysql in docker

Solution: Cannot connect to mysql in docker

After installing mysql in docker, the following error occurred when connecting with SQLyog.

 2059 : Authentication plugin ‘caching_sha2_password’ cannot be loaded:  

img

The solution is as follows:

1. Check whether the mysql we want to connect to is started

#查看在运行的容器
docker ps -s 

2. Enter the container

#docker exec -it 容器号 /bin/bash
docker exec -it b30062adc08c /bin/bash

3. Run mysql

mysql -u root -p

#输入密码(跟之前在windows上运行mysql是一样的)

img

Finally enter the update password statement:

#我这里的密码是123456
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

4. Restart mysql, and then use the tool to connect.
Insert picture description here
Pay attention to enter the ip of your own server.

Guess you like

Origin blog.csdn.net/hello_cmy/article/details/106321621
Recommended