Access MySQL from Host being on Vagrant

Access MySQL from Host being on Vagrant

For this all you would need is tunneling/port forwarding from vagrant to mysql.

Being on vagrant machine, figure out what the host ip is, usually netstat would tell you that.
The default being 10.0.2.2 and assuming you have 3306 port on host machine do the following

ssh username@10.0.2.2 -L 3306:127.0.0.1:3306 -N

The above would forward the 3306 [ the one on the left ] to the hosts port. Mind you, you have to use 127.0.0.1 to access your vagrant machine in place of localhost which might not work.

Configuring PHP + MySQL + Apache on Amazon EC2 Step by Step

Mount to NSF Server timed out on Vagrant

Setting new Vagrant machine for PHP-Mysql development

error duplicate entry for key when creating new unique key mysql

Port not forwarded from vagrant for rails application on host

Using mysql keyword as column in Doctrine Entity – PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*