6

I have started work on a wordpress site with a colleague. We are both developing the website on our local machines and have our separate databases. We share our work through Git. Now the problem is that I found out that wordpress uses the database to store some configurations regarding themes and plugins.

How can we share our database to have the same version all the time?

5
  • Would copying the entire database content from one dev site to the other be an option? Or do you want to allow two developers to make changes at the same time, and then merge the changes to a new common state? The latter is much more difficult.
    – The Nail
    Commented Jan 15, 2012 at 11:36
  • Could you not have one central database that is accesible from each machine (via internet)? if not, why? Commented Jan 15, 2012 at 11:38
  • Oh BTW, did you know there is a stackexchange for wordpress? wordpress.stackexchange.com
    – The Nail
    Commented Jan 15, 2012 at 11:39
  • The best way to keep two development databases in sync might be just to tell the other developer what you have changed/configured, and let them update their database in the same way. If possible, use update scripts that you run on both environments. How are you propagating your changes to a staging/production environment?
    – The Nail
    Commented Jan 15, 2012 at 11:44
  • For now we are in a development environment so not yet in production. We would like the developers to make changes at the same time and then merge the changes to a new common state. I guess we could use one central db. Notifying him on each change I think is not doable, for each option changed in the theme for example, it would mean telling the others what is done, etc...
    – nche
    Commented Jan 15, 2012 at 15:45

2 Answers 2

1

Just set up a database on a server that runs MySQL and allows access for both of you. Then you should change these lines in wp-config.php:

define('DB_NAME', 'remote database name');

/** MySQL database username */
define('DB_USER', 'remote user name');

/** MySQL database password */
define('DB_PASSWORD', 'remote password');

/** MySQL hostname */
define('DB_HOST', 'remote server address');

See also the WordPress support topic http://wordpress.org/support/topic/setting-up-wp-with-remote-database. Just keep the code in Git.

0

This is something that I struggle with as well. You have a few options, non of which are ideal. Your first is to host the database externally, IE thorugh amazon RDS, this will give a "cloud" database, that you can both access (so log as you add the IPs), or you can just use a shared host's database. The second option is to have two separate, local DBs, and include the .sql dump in there as well, but there are problems with that as well.

I'd ask you to refer to a question I posted myself a few days ago, and got some REALLY solid answers from: Using version control (Git) on a MySQL database

Hope I helped

Not the answer you're looking for? Browse other questions tagged or ask your own question.