MySql Workbench is a great tool for Database Administration and visualization. You can easily view all the Tables, Views, Stored Procedures, etc. available in a Schema and also, view the Data each table is handling and run queries. Workbench can be connected to any DB Server creating a SSH Tunnel. For local development this are the steps to follow if you are using a Vagrant Virtual Machine.
Prerequisites:
- Have downloaded and installed MySql workbench
- Have a MySql / MariaDB server installed and running.For local development you may refer to: Configure MariaDB in a Vagrant Virtual Machine
Step 1. Turn on your vagrant virtual machine:
~/devzone/cool_vagrant_project$ vagrant up
Step 2. Get from the Vagrantfile the ip you set for private network:
# Use private network
config.vm.network "private_network", ip: "192.168.56.10"
Step 3. Open MySql Workbench and create new Connection.
- Enter that ip in the SSH Hostname followed by the :22 port
- Use vagrant as SSH Username
- Leave SSH Password
- Provide the absolute path to:
/home/.../.../cool_vagrant_project/.vagrant/machines/default/virtualbox/private_key
- For the MySQL Host enter 127.0.0.1
- Port 3306
- Enter Username and Password of the user (Refer to Vagrant Virtual Machine with CentOS 7, Nginx, MariaDb, NodeJs and PHP 8 and Configure MariaDB in a Vagrant Virtual Machine )
- You may leave the default schema empty.
Step 4. Click on Test Connection Button. If ok, then close the dialog and your new connection is ready to be used
From now on, you just need to click on that connection button to open a query editor:
Close the session closing the tab.