How do config VPS to allow Remote Connect from Desktop Application to MySQL of my VPS ?

December 6, 2015 1.1k views
DigitalOcean MySQL CentOS

Hi, DO Support Team

I can't connect to MySQL Server of My DigitalOcean VPS from my JAVA Application ( i use MySQL Workbench to check connection but this still receive error - Can't connect to MySQL server (10060) ).

I have edit my.cnf file (

port = 3306
bind-address =

and run SQL : GRANT ALL PRIVILEGES ON database.* TO user@'%' IDENTIFIED BY 'password';

But nothing change. Please help me ! Thanks you

2 Answers

Hi, i solved my issues. I using Centmimod and i have opened port for MySQL Connection from CSF Firewall config file ( /etc/csf/csf.conf )

It is very bad to open MySQL (or any database for that matter) to the internet. You should turn back on the firewall to block all ports (minus whatever you need). Leave MySQL (3306) blocked to anything that is not your servers. If you need remote access, you should use tools like SSH port forwarding. It is a lot more secure (assuming you only use key auth) and encrypts your traffic to the server. Plus you don't need to give everyone access to 3306 (very bad!). An example:

ssh -L <Any local port higher than 1000>:localhost:3306 myserver.domain.tld

Reason you should pick a local port higher than 1000 is you won't need root to use it.

  • Thanks for your support, i understand this problem and i will closed this port. I will use Socket to solve this problem.

Have another answer? Share your knowledge.