首先必须保证主机和虚拟机能ping通.
桥接网卡即可。
主机端进入mysql输入
mysql -u root -p ****
接着输入
grant all PRIVILEGES on test.* to root@'192.168.1.101' identified by '123456';
test为库名,root为分布的用户名,表示允许使用192.168.1.101地址连接主机123456为设置的密码
此配置为指定机器访问,若需要多台访问,
Grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
- %表示是所有的外部机器
- 如果还未生效,则重启MySQL服务器,或运行下面这句
mysql> flush privileges;