首先要保证本机能访问虚拟机的网络
并且虚拟机开通了mysql的访问端口
进入容器
docker exec -it 容器id /bin/bash
进入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';