1

Trying to get in to this vagrant box using Sequel Pro. The Error Detail screen is;

Used command:  /usr/bin/ssh -v -N -S none -o ControlMaster=no -o ExitOnForwardFailure=yes -o ConnectTimeout=10 -o NumberOfPasswordPrompts=3 -o TCPKeepAlive=no -o ServerAliveInterval=60 -o ServerAliveCountMax=1 vagrant@control.example.dev -L 57790:127.0.0.1:3306

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Control socket " none" does not exist
debug1: Connecting to control.example.dev [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host control.example.dev port 22: Connection refused

I can log in to mysql on the command line once I have ssh'd in (vagrant ssh).

I can get in just with mysql -uroot -p and then blank for password.

My connection on Sequel Pro is;

MySQL Host: 127.0.0.1

Username: root

SSH Host: control.example.dev

SH User: vagrant

Everything else is blank!

Community
  • 1
  • 1
mikelovelyuk
  • 4,042
  • 9
  • 49
  • 95

3 Answers3

5

I had this same problem. I had destroyed my previous vagrant box and rebuilt it using the same IP address. I kept getting this problem despite the fact that I had all the credentials correct, as pictured above.

For me the fix was to delete the IP record from ~/.ssh/known_hosts. The errors were only telling me that the connection was rejected, and the "tunnel unexepectedly closed."

Another solution to this problem is to just add your own id_rsa.pub key to the VM's /home/vagrant/.ssh/authorized_keys file. This will effectively give you access to your VM the same way you'd typically grant yourself passwordless ssh access to any Ubuntu box.

ctlockey
  • 333
  • 3
  • 12
2

When you run vagrant ssh, you are already in the VM and by default a socket connection is used to connect to the MySQL database.

To connect using Sequel Pro, or from your host machine into Vagrant guest's MySQL instance, you will need to tunnel your connection through SSH. By default, vagrant uses port 2222. You will also need to connect to the Vagrant guest VM using private key and the user vagrant.

The Vagrant guest's private key is located in the .vagrant/machines/[machine-name]/virtualbox directory where the Vagrantfile is located. Assuming you create a Vagrant guest called debian in your home directory, it should be located in

/user/your_name/vagrant/machines/debian/virtualbox/private_key

In Sequel Pro, use this private key and the vagrant username, and port 2222 to connect.

Sequel Pro vagrant connection settings

Hanxue
  • 12,243
  • 18
  • 88
  • 130
0

Double-check all of your MySQL and SSH details. Re-enter everything! Better to copy and paste to avoid accidental errors. I had exactly the same issue and it was caused by an incorrect IP address.

Darren Murphy
  • 1,076
  • 14
  • 12