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:
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是一样的)
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.
Pay attention to enter the ip of your own server.