Vagrant: open mysql connection to host

I want to use MySql Workbench to view my database in Vagrant from the host machine.

So far I just commented out the line bind-address = 127.0.0.1

in my.cnf

and everything was fine, but I recently connected to a new wi-fi and everything seemed to change, I had to change the guest ip address from 192.168.0.200

to 192.168.1.200

and I cannot open mysql connection with host.

I also tried adding a bind-address = 10.0.2.2

guess (not sure), it was my host IP, but still the same.

What do I need to do?

thank

+3


source to share


1 answer


Define a static ip for your field as in this example:

Vagrant.configure("2") do |config|

      config.vm.network "private_network", ip: "10.0.0.6"

      

In Mysql Workbench create a new SSH connection:



Connection Method: Standard TCP/IP over SSH

SSH Hostname: 10.0.0.6 (like above)

SSH Username: vagrant

SSH password: vagrant

MySQL Hostname: 127.0.0.1

MySQL Username: root

MySQL Password: root

      

SSH host host id:

You can use a private secret key instead of a password. You can get the path by running vagrant ssh-config

.

+7


source







All Articles