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.
- From the command line in the directory of your vagrant box: vagrant ssh-config
- It will return the hostname, port and Identity File – make a note of these.
- From the MySQL Workbench, create a new connection
- Set the connection method to: Standard TCP/IP over SSH
- SSH Hostname: use the hostname and port from step #2, such as 127.0.0.1:2222
- SSH Username: vagrant
- SSH Key File — click on the […] box and then locate the file indicated under Identity File
- Username: root
- Password: root
You should be all set to connect to an MySQL Server on a Vagrant Virtual Box over SSH.