Connect MySQL database in Vagrant VM from Host machine
This gist shows how to connect to your vagrant MySQL database from the host machine.
vagrant ssh
/etc/mysql/my.cnf
:
bind-address
to 0.0.0.0
to allow all incoming connection attemptsmysql -uroot -proot
mysql>
appearsGRANT ALL PRIVILEGES ON *.* TO username@'%' IDENTIFIED BY "password";
username@'%'
grants access from all hostsStandard TCP/IP over SSH
127.0.0.1:2222
if your VM is listening on port 2222
(showing on VM startup)vagrant
or your vagrant user
IdentityFile
when you type vagrant ssh-config
on your vagrant root folder (in case vagrant uses SSH auth method: private key
. Showing on VM startup)SSH auth method: password
on your VM