Answer the question
In order to leave comments, you need to log in
How to share a database for a virtual machine (Vagrant)?
Just recently started using Vagrant. I myself sit on Windows 8, I had a project. With the help of Vargant, I created a virtual machine with ubuntu and shared the project folder. The project has started, everything is fine, though the database does not see, which is logical. So I'm interested in how to set up the project (host, port, etc.) so that it connects to my (host) database. In one of the topics on Habré about vagrant, I read comments where they wrote that it was more reliable to store the database on the host machine, so I concluded that the connection was possible.
Answer the question
In order to leave comments, you need to log in
you started the virtual machine. This means that you will fumble for her on the network. Through which network - private or local, it depends on the desire.
On the host where you have the database, you need to configure access to the database over the network. Then you need to set the connection parameters in your project.
The question is "how to set up a project (host, port, etc.) so that it connects to my (host) database?" completely incorrect this is your project and what it consists of and what technologies it is built on, only you know.
The question "how to share a database for the Vagrant virtual machine" is also incorrect. Vagrant is not a virtualization system, but just a tool for setting up virtual machines on various virtualization systems.
I came across this question, it's strange that it has not been answered here yet.
In short, all connection parameters can be viewed using the command
By default, you can use this data to connect via an ssh tunnel:
host: 127.0.0.1
port: 2222
user: vagrant
password: vagrant
then a normal database connection (for example, localhost:3306, your database name, password, etc.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question