Ubuntu – Sometimes: Unable to connect to host 127.0.0.1, or the request timed out. MySQL through Sequel PRO

MySQLUbuntuubuntu-10.04

I have been struggling with this issue for over a year now, and it’s really giving me a headache.

I often experience I am unable to connect to the MySQL server through SequelPRO. If I ssh into the server, I can use mysql fine, see processes, etc. My web app works fine too.

When I try to SSH into my MySQL database through Sequel PRO, this message appears instantly:


Unable to connect to host 127.0.0.1, or the request timed out.
Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).
MySQL said: Lost connection to MySQL server at 'reading initial communication packet', system error: 0


ONLY solution is to reboot the server. Sometimes I’d reboot the server, and it still won’t work. After a few reboots it works. But usually it works every time.

  • It happens on all my different forge servers (php5 & php7) and has happened since day one.
  • Restarting the mysql server (like sudo service restart mysql) does not work
  • It happens on different networks (wifi, local, etc)
  • I can connect fine from another mac with different SSH-key (same OSX and Sequel Pro build). I have even tried copying my own SSH key to the other computer, and logging on through that. That works fine as well.
  • I happens at random times, often if my Sequel Pro was open when my mac when to sleep (but not always – sometimes I can open it 24 hours later, and still be connected). But all of a sudden, I’d be disconnected, and when I try to login again, it see the following error:
  • In some situations, I can login again to MySQL through sequel pro, even though I did not do anything (i.e. reboot server).

The way I connect:

MySQL Host: 127.0.0.1
Username: something
Password: something
Port: 3306
SSH Host: server-ip
SSH User: something
SSH Key: path to my id_rsa
SSG Port: default/not-set

Any ideas?

My Sequel Pro version: v1.1 build 4499
My OSX: OS X El Capitan v 10.11

Server: Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-71-generic x86_64)

MySQL: Ver 14.14 Distrib 5.7.10, for Linux (x86_64) using EditLine wrapper

Best Answer

Looks like you're having issues connecting through SSH or maintaining the SSH tunnel, these errors are usually reported to /var/log/auth.log. Probably SequelPRO tries to use a connection that is no longer available, stalled.

You may also try to manually set the SSH tunnel: http://www.sequelpro.com/docs/Set_up_an_SSH_Tunnel — if this works, then it's surely a bug/problem with SequelPro SSH connection.