【mysql】用navicat连接虚拟机mysql出现错误代码(10038)

时间:2023-03-09 17:43:20
【mysql】用navicat连接虚拟机mysql出现错误代码(10038)

来源:

http://www.cnblogs.com/ohmydenzi/p/5521121.html

http://blog.csdn.net/chana1101/article/details/39641415

错误信息: 2003-Can't connect to MySQL server on 'xxxxx'(10038)

1.在windows下,cmd 输入

telnet  192.168.xx.xxx 

其中ip是虚拟机的ip.如果连接失败

2.在虚拟机下输入

netstat -anp| grep 

看结果,如果结果中3306前面的ip不是0.0.0.0

3.修改/etc/mysql/mysql.conf.d/mysqld.cnf

把 bind-address = 127.0.0.1 改为 bind-address = 0.0.0.0

上面的意思是改为监听所有地址

4.对于普通用户,添加权限

mysql>grant all privileges on *.*  to  'root'@'%'  identified by 'youpassword'  with grant option;
mysql>flush privileges;