Question

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

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)


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

for people that are using a cloud vm such as (azure,google,amazon) you should add the 3306 port to your vm from your portal settings then from your firewall

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 ###################################################

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.