首先要保證本機能訪問虛擬機的網絡
而且虛擬機開通了mysql的訪問端口node
進入容器
docker exec -it 容器id /bin/bashmysql
進入mysql數據庫開啓遠程訪問權限
- mysql -uroot -p
- use mysql
- update user set password_expired = "Y"where user="root";
- ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
cmd 遠程鏈接 mysql -h 192.168.218.129 -uroot -p -P 3306