1. $ docker exec -it mysql /bin/bash
2. $ apt-get update
3. $ apt-get install vim
4. $ vim /etc/mysql/conf.d/docker.cnf
5. 文件末尾加入:skip-grant-tables
6. :wq 退出编辑
7. 重启docker: $ docker restart mysql
8. $ docker exec -it mysql /bin/bash
9. $ mysql -u root -p
10. enterPassword 直接enter
11. 进入mysql之后 :$ update mysql.user set authentication_string='' where User='root';
12. $ flush privileges;
13. $ alter user 'root'@'localhost' IDENTIFIED BY '123456'; (密码)
14. $ flush privileges;
15. $ vim /etc/mysql/conf.d/docker.cnf 把最后一行删掉
Navicat 连接mysql8 table performance_schema.session_variables doesnt exist
1. $ vim /etc/mysql/conf.d/docker.cnf
最后一行加入 skip_version_check
2. 在宿主机中 $ mysql_upgrade -uroot -p
输入密码
3. ok Navicat重连