1

I'm trying to connect to a remote MariaDB server through SSH using Navicat Premium from Windows but all the time I can't and get this error:

2013 - Lost connection to MySQL server at 'reading initial communication packet', system error: 0

I have read and follow many guides on Internet so I get lost at this point and don't know what else to do. This is what I have done:

At server side (remote host with CentOS 6.6 and mysql Ver 15.1 Distrib 5.5.44-MariaDB, for Linux (x86_64) using readline 5.1):

  • /etc/my.cnf.d/server.cnf setup this parameters:

    [mysqld] #skip-networking #tried with this bind-address = 0.0.0.0 #tried with this bind-address = 127.0.0.1 #tried with this bind-address = localhost 

    RESULT: No success, same error and can't connect

  • /etc/hosts.allow set this parameters:

    # tried with this #ALL:ALL # tried with this ALL:PARANOID # tried with this ALL:MY_IP_ADDR 

    RESULT: No success, same error and can't connect

  • /etc/ssh/sshd_config setup parameters for allow TCP forwarding:

    AllowTcpForwarding yes

    RESULT: No success, same error and can't connect

Server has IPTABLES enabled but port 3306 is open:

#MySQL/MariaDB -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT 

This is how the configuration looks like on Navicat:

enter image description here enter image description here

Can any give me a hand on this? I have spent hours on this without success

2
  • ssh -L 3306:mysqlServer.example.com:3306 [email protected] and mysql -h 127.0.0.1 -u root -p would be the normal way of doing this. What are you trying to accomplish by connecting through an SSH tunnel? Commented Jun 30, 2015 at 17:14
  • @lVlint67 Because server is not open and I can't access directly to port 3306 then I need to connect through a tunnel Commented Jun 30, 2015 at 17:17

1 Answer 1

1

Have you tried 127.0.0.1 as the hostname on the "General" Tab of your application?

It's hard to tell exactly what this application is trying to do (remote/local/dynamic tunnel)


I have to do something similar to get to a remote Oracle Database we use... I have the luxury of having access to either a linux workstation or cygwin.

I am not familiar with the software you are using... But when I have to get into our database from other machines I use PuTTY. A google search (PuTTY Local ssh tunnel) will provide results for instructions: http://howto.ccs.neu.edu/howto/windows/ssh-port-tunneling-with-putty/

Set the local port to whatever you want (I would just use 3306 for clarity) and the destination as yoursever:3306. Then use whatever SQL client you want to connect to 127.0.0.1:3306.

/etc/my.cnf

[mysqld] bind_addess = 127.0.0.1 

iptables -A INPUT -i lo -j ACCEPT #should be the only firewall statement you need assuming ssh is open.. 
1
  • Ok, you have saved my day, setting DB IP to 127.0.0.1 fix the issue, many thanks Commented Jun 30, 2015 at 17:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.