2003 - Can't connect to MySQL server on 'localhost' (10038)

Y.L. picture Y.L. · Sep 15, 2014 · Viewed 38.9k times · Source

I installed mysql server in my ubuntu virtual machine, then I use Navaicat for Mysql to connet mysql, but failed. Navicat for Mysql is installed on Windows 7, Navicat version is 11.0.10, enterprise edition mysql is installed in my virtual machine, the system is Ubuntu 12, when I connect the mysql server, it returns: enter image description here

my navicat connection configuration: enter image description here

I tried several methods, including use the command: grant all privileges on . to 'root'@'%' identifed by 'passwd' with grant option and I shutdown the firewall of ubuntu using: ufw disable and I hava also shutdown the firewall of windows 7, the state of port 3306 of the ubuntu server is: enter image description here

the iptable rules is like this: enter image description here

the mysql.user table is like this: enter image description here

but still, the navicat gives me the error: 2003 - can't connect to mysql server on 'localhost' (10038)

anyone can help me? thank you!

Answer

Y.L. picture Y.L. · Sep 18, 2014

I solved this problem. In my /etc/mysql/my.cnf, the command bind the locahost address like this: bind-address=127.0.0.1, just add a # before it. and now I can connect to the mysql server smoothly.