Connect MySQL Workbench to Vagrant Box over SSL

There are multiple options available to connect to your MySQL database instance when it is located inside of a Vagrant Box such as Cognac Box or ScotchBox.

  1. From the command line in the directory of your vagrant box: vagrant ssh-config 
  2. It will return the hostname, port and Identity File – make a note of these.
  3. From the MySQL Workbench, create a new connection
    1. Set the connection method to: Standard TCP/IP over SSH
    2. SSH Hostname: use the hostname and port from step #2, such as 127.0.0.1:2222
    3. SSH Username: vagrant
    4. SSH Key File — click on the […] box and then locate the file indicated under Identity File
    5. Username: root
    6. Password: root

You should be all set to connect to an MySQL Server on a Vagrant Virtual Box over SSH.