3

I am running Debian 8.2 and the install is quite fresh. I try to connect to my MySQL server via SSH using Sequel Pro. I always get this error:

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

When I run

mysql -u root -p 

on the server, everything works perfectly. But not from remote.

At first I thought it might be iptables, so I (temporarily) disabled all rules. iptables -L now returns:

Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination 

Then I checked my.cnf, but all the parameters I could think of look correct:

[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking bind-address = 127.0.0.1 

The output of my mysql log files also looks ok

150609 17:15:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150609 17:15:07 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 150609 17:15:07 [Note] /usr/sbin/mysqld (mysqld 5.5.43-0+deb8u1) starting as process 18347 ... 150609 17:15:07 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 150609 17:15:07 [Note] Plugin 'FEDERATED' is disabled. 150609 17:15:07 InnoDB: The InnoDB memory heap is disabled 150609 17:15:07 InnoDB: Mutexes and rw_locks use GCC atomic builtins 150609 17:15:07 InnoDB: Compressed tables use zlib 1.2.8 150609 17:15:07 InnoDB: Using Linux native AIO 150609 17:15:07 InnoDB: Initializing buffer pool, size = 128.0M 150609 17:15:07 InnoDB: Completed initialization of buffer pool 150609 17:15:07 InnoDB: highest supported file format is Barracuda. 150609 17:15:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 150609 17:15:08 InnoDB: Waiting for the background threads to start 150609 17:15:09 InnoDB: 5.5.43 started; log sequence number 1654586 150609 17:15:09 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 150609 17:15:09 [Note] - '127.0.0.1' resolves to '127.0.0.1'; 150609 17:15:09 [Note] Server socket created on IP: '127.0.0.1'. 150609 17:15:09 [Note] Event Scheduler: Loaded 0 events 150609 17:15:09 [Note] /usr/sbin/mysqld: ready for connections. 

And I cannot find any problems with my Clients configuration:

MySQL Host: 127.0.0.1 User: root Password: *** Port: 3306 SSH Host: mydomain.com SSH User: sshuser SSH Key: sshkey 

I also don't have anything in /etc/hosts.allow and /etc/hosts.deny

Note that SSH connects successfully but MySQL fails.

I am lost. Can anybody help?

1 Answer 1

7

Well, if anybody should ever encounter the same problem:

Note to self: When setting up SSH, you MUST set the following option in /etc/ssh/sshd_config:

AllowTcpForwarding yes

If you don't, then your packets will be silently dropped at the server. This results in the above error message.

Credit goes to achbed

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.