Question

ERROR 2003 (HY000): Can't connect to MySQL server on 'XXX.XX.XX.XX' (110)

Posted October 28, 2017 63.2k views
Ubuntu MySQL Apache Firewall

I had setup another instance only for MySQL server.

This is overall what I did to setup my remote access for MySQL:

Configure

vi /etc/my.cnf
[mysqld]
bind-address=SQL-SERVER-IP
# skip-networking
 /etc/init.d/mysql restart

Allow firewall ports

sudo ufw allow 3306/tcp
sudo ufw allow 3306
sudo ufw allow 8080/tcp
sudo ufw allow 8080
sudo service ufw restart

Grant access to remote IP address

mysql -u root -p mysql
GRANT ALL ON foo.* TO root@'SECOND-INSTANCE-SERVER-IP' IDENTIFIED BY 'PASSWORD';
Query OK, 0 rows affected, 1 warning (0.00 sec)
exit

Test it

mysql -u root -h 'SECOND-INSTANCE-SERVER-IP' -p

Error produced:

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘SECOND-INSTANCE-SERVER-IP’ (110)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

8 answers

Can you do telnet localhost 3306 ?

I’m having the same issue with same setup.

Even im facing the same issue.

i granted permissions for all

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘XXX.XXX.XXX.XXX’ (113)

I’m also experiencing this issue. Installed on Ubuntu Server 18 LTS, MySQL 14.14.
Please let me know if you have fix on this.

hello @longsookeat I don’t know if this is too late but this is how I solved mine

I set up two droplets. one for MySQL server and another for ubuntu 18 where I access the MySQL database from.

On MySQL server droplet, I set up a user root@‘public-IP-for-ubuntu-18-droplet’ and grant full access to the database’. Then allow firewall port as you did on MySQL server droplet and change the bind-access to 0.0.0.0.

And ongoing back on my ubuntu droplet login and simply remotely access my database
==> $ MySQL -u root -h 'MySQL-server-droplet-public-IP’ -p

HOPE THIS HELPS SOMEONE

Submit an Answer