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
ALTER USER 'root'@'%' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'ang123';
#Make changes effective
flush privileges;
7. At this time, Navicat can be used for remote connection
Read More:
- [Solved] Navicat connection error 1251 compatibility with docker MySQL
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- [Solved] There is a problem with mysql8.0 without password in Navicat connection
- [Solved] SQLSTATE[HY000] [2002] Connection refused to report an error when PHP connects to mysql in the docker container
- [Solved] Navicat Connect MySQL error: Authentication plugin ‘caching_sha2_password‘ cannot be loaded
- [Solved] docker mysql SQLSTATE[HY000] [2002] Connection refused
- Navicat connected to Mysql error: Client does not support authentication protocol requested by server;
- [Solved] mysql 2003 remote access failed mysql8 configure remote access
- [Solved] MySQL 8 Connect Navicat error: error 2059
- How to Solve Navicat open view error
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- Docker mysql8 modify password
- How to Solve MYSQL Error: Failed to start MySQL 8.0 database server
- Mysql 8.0.13 Enabling remote access (ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th)
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- How to Solve mysql [Err] 1067-Invalid default value for
- How to Solve c3p0 connect mysql8.0 Error
- How to Solve MYSQL Error: No module named MySQLdb
- How to Solve Mysql8 load data error