Docker: How to Solve MYSQL8 & Navicat remote connection error

1. Download Image

docker pull mysql:8.0.26

2. Operation container

docker run -p 3306:3306 --restart=always -e MYSQL_ROOT_PASSWORD=ang123 --name mysql -d mysql:8.0.26

3. At this time, an error will be reported when using Navicat to log in, because the encryption methods of mysql8 and 5 are different, and the encryption method needs to be modified

4. Enter MySQL container

docker exec -it mysql bash

5. Log in to MySQL and modify the encryption method

mysql -uroot -pang123;

use mysql;

#Modify encryption method
alter user 'root'@'%' identified with mysql_native_password by 'root';

#View modified data
select host,user,plugin from user;

Revised as follows:

6.At this time, the local Navicat remote connection to MySQL in Linux still reports an error 1045, but the password is correct, and the grant authorization does not solve the problem

The final solution is as follows. Just change the password again. The password is still the original password


#Make changes effective
flush privileges;

7. At this time, Navicat can be used for remote connection

Read More: