My MySQL client (Sequel Pro) is set up to connect to Vagrant over SSH. I've setup the following in my ~/.ssh/config
file:
Host vagrant
HostName 127.0.0.1
CheckHostIP no
Port 2222
User vagrant
IdentityFile ~/.vagrant.d/insecure_private_key
Everything works fine if I haven't run vagrant ssh
. But once I've logged into the Vagrant box with that command Sequel Pro can no longer connect via SSH - it just says "The SSH Tunnel has unexpectedly closed." So I have to run vagrant reload
before I can connect to the MySQL server.
Does anyone know how to get around this issue?
I got around this issue by using port forwarding instead of SSH tunnelling. I added the following to Vagrantfile
:
config.vm.network :forwarded_port, guest: 3306, host: 8306
Then connected to MySQL via port 8306
.