Connect to VM database

Problem

Connect to VM database from your machine.

Solution

When you have created a virtual machine e.g. drupal vm once everything has gone well then you would need to ssh to VM and add database and grant privileges to your user name to all databases. To do that do the following:

mysql -u root -p

when prompted for password just enter root.

mysql> GRANT ALL PRIVILEGES ON *.* TO PrivUsername@localhost IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO PrivUsername@"%" IDENTIFIED BY 'password' WITH GRANT OPTION; 
mysql> FLUSH PRIVILEGES;  

Once you do that you can then be able to connect to VM database using tools like Sequel Pro etc.

if you get this error:

SSH connection failed! sequel pro vm vagrant you need to go to kown_hosts and delete the part to do with the VM

by default ssh detail for drupal vm are:

ssh host: is the ip
ss user: vagrant
ssh password: vagrant