Failed to connect to MySQL at with user root cannot connect to MySQL server on (10060)

Failed to connect to MySQL at with user root cannot connect to MySQL server on (10060)

Failed to connect to MySQL at with user root cannot connect to MySQL server on (10060)

While I was trying to access MYSQL server configured in cent OS server through MySQL workbench, connection
method – Standard (TCP/IP).
it throws an error like “Failed to connect to MySQL at with user root
Cannot connect to MySQL server on (10060)” Image -1

Failed to connect to MySQL at with user root cannot connect to MySQL server on (10060)
Image – 1

I was able to ssh to the Cent OS server without any error also I tried to connect through MySQL workbench
Connection Method – Standard TCP/IP over SSH and I am able to connect.

Only issue I was not able to connect using Standard TCP/IP. after much google about the error.
I could find a solution.
Tried turning off iptables
$ sudo service iptables stop
you may ask like we can also disable firewall
$ sudo ufw disable
Define iptables : iptables is a command line utility for configuring Linux kernel firewall
Define ufw : uncomplicated firewall, is a frontend for iptables. but more options we will get in iptables.

but its not wise to turn off iptables instead we can try allowing the necessary port from outside network
to the server.

How to check status of iptables
$ iptables -L

output will be like this (Image – 2)

Failed to connect to MySQL at with user root cannot connect to MySQL server on (10060)
Image – 2

To stop/start iptables service
$ sudo service iptables stop/start

here we need to allow mysql port 3306 from iptables.
$ iptables -A INPUT -i eth0 -p tcp –dport 3306 -m state –state NEW,ESTABLISHED -j ACCEPT

$ iptables -L
$ sudo service iptables save
$ sudo service iptables restart
$ iptables -L

now you can see the entry in iptables for the port 3306.

also there is a lot to change in etc/my.cnf file
$ sudo nano /etc/my.cnf
Comment out ‘skip-networking’ and Also bind-address = 127.0.0.1
then save and exit from the nano editor.

$ sudo service mysql restart

This needs to be done first in server by logging in to mysql but in my case this was already done so that I was able to connect the server. still for someone who is not able to access, please do this first.
mysql> grant all on *.* to ‘user’@’host_name’ identified by ‘Password’;
mysql> FLUSH PRIVILEGES
mysql> exit

lets now restart the machine once
$ sudo shutdown -r now

Hopefully you are able to access the MYSQL server configured in Cent OS through MYSQL Workbench using connection method Standard TCP/IP.

I will write much about iptables commands in my next post…

You may also like: New Features Of Windows 10 Operating System

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.