Navicat connects to the docker container mysql on the virtual machine and reports 1251 error

(1) Log in to mysql in the container, enter mysql> command line
1, docker exec -it container id bash
2, mysql -uroot -p //-uroot
3, enter the password
4, enter mysql> command line interface
(2) for authorization Remote connection (note that mysql 8.0 is different from the previous authorization method)
1. mysql> GRANT ALL PRIVILEGES ON . TO'root'@'%'WITH GRANT OPTION;
2. mysql>FLUSH PRIVILEGES;
(3) Change the encryption rule
ALTER USER ' root'@'localhost' IDENTIFIED BY'password' PASSWORD EXPIRE NEVER;
(4) Update the root user password
ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY'password';
'password' allows you to set a new password or the same as before
the refresh permission to
flush privileges;
(5) set up, connect to the database using Navicat again using the new password 'password'

The example is as follows; I am using the root user and the password is root
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_2662385590/article/details/105682909