Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Using MySQL, Vagrant, PHP and Git together

A friend and I just started developing a dynamic, database-driven website.

We set up a development environment using the following tools:

  1. VirtualBox

  2. Vagrant (box: avenuefactory/lamp)

  3. Git and GitHub

This setup is as identical as possible on both computers. We share the same vagrantfile (it's part of our repository on GitHub).

This works great, with one notable exception: The MySQL database.

When I halted my Vagrant box and rebooted my computer, the database I had just made vanished. I also haven't found a way of sharing the database with my co-developer.

How do you recommend that I handle the database in our development environment?

Ideally, we would both have access to an always up-to-date database.

2 Answers

Amadeo DeSouza
Amadeo DeSouza
18,445 Points

I would love to know how to do this as well. I've been working with vagrant and laravel locally, and just now how have to figure out how to set it up for my partner, with git. Haven't even got to the DB part, but see this is going to be an issue.

Update: We abandoned virtualization and decided to just go for local installations of XAMPP from https://www.apachefriends.org/. The database part is a bit awkward. We export it using PHPMyAdmin and store it in the Git repository for the other to download and import. This setup works for us, but I think it would get exponentially more difficult by adding more people.