This gist shows how to connect to your vagrant MySQL database from the host machine.
- Connect to vagrant using vagrant ssh
- Edit file /etc/mysql/my.cnf:- Change parameter bind-addressto0.0.0.0to allow all incoming connection attempts
- NOTE: Do not allow this in production
 
- Change parameter 
- Change privileges of the MySQL user to allow connection attempts from any host:
- On host connect as root user using mysql -uroot -proot
- mysql>appears
- Insert GRANT ALL PRIVILEGES ON *.* TO username@'%' IDENTIFIED BY "password";
- username@'%'grants access from all hosts
 
- On host connect as root user using 
- Add a new connection with the following parameters
- Connection Method: Standard TCP/IP over SSH
- SSH Hostname: 127.0.0.1:2222if your VM is listening on port2222(showing on VM startup)
- SSH username: vagrantor your vagrant user- SSH Key File: Use the path showing at IdentityFilewhen you typevagrant ssh-configon your vagrant root folder (in case vagrant usesSSH auth method: private key. Showing on VM startup)
- SSH Password: In case you use SSH auth method: passwordon your VM
 
- SSH Key File: Use the path showing at 
- MySQL Hostname: 127.0.0.1
- MySQL Server Port: 3306
- Username: Your MySQL username
 
- Connection Method: 
It worked like magic. Thanks