Connecting SQL running on Vagrant machine through remote host?

562 Views Asked by At

I am trying to connect Emma to MySQL running on Vagrant Machine with nginx from a remote location. The server (host) has a static ip that can be accessed through internet. It also has its own running MySQL instance that I can connect to. However I want to connect to Vagrant's MySQL from a remote location.

1

There are 1 best solutions below

1
Dag Høidahl On BEST ANSWER

You will need to expose the port of the MySQL server's running on Vagrant to the public internet. There are a number of ways, but the simplest should be configuring Vagrant with port forwarding.

Since you already have another MySQL server running on the host, you would need to forward on another (free) port than the default, for example 6306:

Vagrant.configure("2") do |config|
  config.vm.network "forwarded_port", guest: 3306, host: 6306
end

You would also need to explicitly specify that port in the connection url in Emma.