S
S
SeoNk2017-03-28 10:56:37
MySQL
SeoNk, 2017-03-28 10:56:37

How to set up connection to remote MySQL in PhpStorm (via Vagrant)?

I have Ubuntu.
It has a CentOS virtual machine installed via the VirtualBox + Vagrant bundle.
MySQL is installed in this virtual machine, there is a trop database and a user with rights to it.
When I try to connect to the specified database, I get an error message:
Exception creating connection to: localhost; nested exception is: java.net.NoRouteToHostException
: No route to host

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Adamos, 2017-03-28
@Adamos

localhost is the machine you are working on.
You also need to specify the network address of the virtual machine.
Most likely, access to the database from the outside is closed by default - you will need to allow it.

S
Sergey Novikov, 2017-03-30
@BOOMER_74

Vagrant by default (or manually) has port forwarding for SSH (localhost:2222). When creating a database connection, specify that you need to work through SSH using the key (in the .vagrant/*/private_key folder). Next, configure the connection itself through localhost (this will already be a virtual machine).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question