Vagrant and MySQL Workbench

I had an absolute pain getting Vagrant and MySQL Workbench to play nicely — here’s the fix!

The choice was either get MySQL Workbench working with the VM’s database, or add a provisioning script to install phpMyAdmin. The latter wouldn’t have been that bad, but the former is definitely preferable.

It turned out to be fairly simple and the stumbling block was that sources had said to use the SSH key at %HOME%\.vagrant.d\insecure_private_key. Here’s the setup:

MySQL Workbench for Vagrant

  • Connection Method: Standard TCP/IP over SSH
  • SSH Hostname: 127.0.0.1:2222
  • SSH Username: vagrant
  • SSH Password: vagrant
  • Leave SSH Key File blank, despite what you may read elsewhere
  • MySQL Hostname: localhost
  • MySQL Server Port: 3306
  • Username: root
  • Password: root

Test Connection

It’s worth clicking Test Connection to check everything’s working. You may be prompted by SSH Server Fingerprint Missing which just means the host is unknown because you’ve never connected to it. Click Continue and you should be greeted by a new windows saying Successfully made the MySQL connection.

If all is well, click OK and be on your merry way. If not, check your VM is up and your settings are correct.

Leave a Reply

Your email address will not be published.