目标:远程连接虚拟机中的MySQL 效果图如下 1. VBox设置好端口转发 具体步骤请看 VM VirtualBox 网络地址转换(NAT)使用详解 2. MySQL授权 如果这时我们就去远程连接MySQL数据库,会提示 必须先授权,授权方法有多种,这里只介绍其中的一种 mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option; Query OK, rows affected…
首先要保证本机能访问虚拟机的网络 并且虚拟机开通了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…