connect to database hosted in docker and vagrant

Greetings,

I would like to connect phpstorm to my database (mysql) in order to have the data source set for raw SQL inspections.

This database is a docker container located on a virtual machine managed by vagrant.

 

I have been able to properly configure vagrant and its ssh connection (connection is OK) but now I'm stuck. If I go to the DB connection setup in PHPStorm, I don't know what to do next:

- a "normal" configuration can't work, since the DB is not directly on my machine

- a connection through SSH/SSL will connect to my VM and seek for DB there, but not in docker

 

Is there a way to achieve such a thing?

3 comments
Comment actions Permalink

Good idea! 

 

My ports were not exposed, but I did and since my VM runs on a static IP, I have been able to connect to my DB by using this IP and the newly exposed port.

 

Thank you!

1
Comment actions Permalink

Cool, thank you for the update!

1
Comment actions Permalink

Do you have your Docker-based MySQL server ports exposed? Are you able to connect to the DB from within Vagrant VM? 

0

Please sign in to leave a comment.