Navicat and remote MySQL connection problems

Posted October 24, 2014 21.3k views

Having a rough time trying to connect to my droplet’s MySQL server through an external software called Navicat. here’s what I’ve done so far;

• adjusted my.cnf to be bound to and checked through netstat that is listening
• followed this tutorial to open up 3306 -

Still, when trying to connect, I get the following error (delivered very fast);

“CONNECTION FAILED - Server unexpectedly closed network connection”

I’m trying to use SSH credentials with my root MySQL username & password on the IP and port 3306.

Can you point me in the right direction here?

1 comment
  • How are you trying to connect to it? If I run:

    mysql -u root -h -p

    I’m presented with the password prompt.

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.

Submit an Answer
2 answers

I’m trying to connect from the software package called Navicat, which isn’t a Command Line interface. It keeps denying me like crazy....pretty pissed about the whole thing!

  • Sorry, I guess I should have asked if you’ve tried with the command line or anything else? That way we could potentially rule out the server-side setup as the issue.

  • I’ve done the following;

    • Adjusted the my.cnf file to completely comment out the bind-address line
    • Adjusted iptables accordingly, and verified that mysql is listening on 3306

    I’ve tried many many different settings within Navicat to try and connect.....still nothing. I’m not a fan of phpmyadmin, which is why I hoped to use Navicat to interface with databases. At this point, any 3rd-part database manager would do though.

  • This is the message I’m getting now…

    Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0

  • MySQL clients could be better at error reporting, but this is pretty straight forward. You’re trying to connect to a server which does not listen to any services, makes sense your client doesn’t understand anything. The package default is to only bind to localhost, commenting it out will revert to default values. Are you positive that it’s actually listening on Check with “netstat -nlp”.

    All of the above said, this is a bad idea. MySQL has a horrible, horrible track record when it comes to security. You don’t want to ever expose it on the Internet unless you’ve made explicit firewall rules only allow certain hosts.

    Navicat supports connecting through a SSH tunnel, check out the documentation about that. This way you can connect to your MySQL-server that is bound to localhost and maintain security. Check the documentation here,

    Alternative clients that support this: MySQL Workbench and SequelPro.

  • @vegardx thanks for your comment. After reading it, I downloaded MySQL Workbench and DbVisualizer, and both were able to connect with no issues at all. It would appear as if this is a Navicat issue rather than a Server problem. Anyways, thanks for the push in the right direction!

  • Got a reply from Navicat today, they have it setup so that you need to SSH using the Keys method. For their software, simply using username & password for SSH simply won’t work!

In navicat I just setup the SSH settings with the same credentials I use for putty and in the General settings like I was in my localhost, thats it.