0

I have a Vagrant box I've setup that I use on two separate machines (one Windows, the other a Mac).

The html, css, javascript files work fine since I use Git to sync them between the two systems. But what about the MySQL database?

When I run vagrant up it executes the following from the Vagrantfile:

config.vm.provision "shell", inline: <<-SHELL
    mysql -u username -p password nameofbox < /var/www/name_of_db_dump.sql
SHELL

The problem is that if I then make changes to the database (e.g. on a WordPress install where I add a page or install a plugin) this isn't synced.

Is there a best practices way to accomplish this sort of database syncing?

Dave Mackey
  • 4,306
  • 21
  • 78
  • 136
  • 2
    See here: http://superuser.com/questions/90301/sync-two-mysql-databases. The best practice is to actually set up replication between the two databases, one as the master, one as a slave. Also this might be helpful: http://dev.mysql.com/doc/refman/5.6/en/replication.html – hughjidette Oct 19 '15 at 16:02
  • 1
    this one is quite old but has good insight http://stackoverflow.com/a/11675271/4296747 – Frederic Henri Oct 19 '15 at 16:29

0 Answers0