Windows中Navicat连接虚拟机中的MySQL数据库

Windows中Navicat连接虚拟机中的MySQL数据库

  1. 先确定虚拟机中mysql -uroot -p能连接上
  2. netstat -apn|grep 3306 ,如果显示的是127.0.0.1:3306

注释/etc/mysql/mysql.conf.d/mysqld.cnf 中的bind-adress 127.0.0.1

重启msyql

再次netstat -apn|grep 3306

显示的是:::3306就可以了

  1. 在虚拟机修改远程登录的权限

方法一:use msyql;update user set host=’%’ where user=‘root’

方法二:grant all privileges on . to ‘root’@’%’ identififed by ‘密码’ with grant option;

修改后

flush privileges; //刷新权限

我用方法1弄好的:Windows中Navicat连接虚拟机中的MySQL数据库

  1. 可以了

Windows中Navicat连接虚拟机中的MySQL数据库

参考

  1. windows中navicat连接虚拟机中的数据库_Lancy_新浪博客