1. docker 啟停命令
啟動 : systemctl start docker
重啟docker服務 systemctl restart docker
重啟docker服務 sudo service docker restart
關閉 docker service docker stop
命令:docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
關閉防火墻重試
查看防火墻狀態(tài):service iptables status
關閉防火墻:service iptables stop
打開防火墻:service iptables start
連接數(shù)據(jù)庫
docker exec -it mysql bash
mysql -uroot -p -h 192.168.122.1
2.授權
GRANT ALL ON?.?TO ‘root’@’%’;
3.刷新權限
flush privileges;
4.還不能遠程訪問,可能Navicat只支持舊版本的加密,需要更改mysql的加密規(guī)則
5.更改加密規(guī)則
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;
6.更新root用戶密碼
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
7.刷新權限,問題解決?good luck