Synchronizing WAMP/MySQL across two local machines?

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Synchronizing WAMP/MySQL across two local machines?

Post by OldRod »

My usual method of synchronizing my project is to do a full export in PHPMyAdmin and then copy that export, along with the entire /www folder to a jumpdrive. When I get on the other machine, I have to do a full erase/import in PHPMyAdmin and then copy my www files from the jumpdrive. When my project was just a few files and one table, this was no problem. But my project has grown and it takes a while to do all this. So I'm looking for a better solution :)

I thought about trying to move my MySQL data folder and the www folder to my DropBox account, but I've read this causes problems since the MySQL files are binary. I thought about installing WAMP directly to my jumpdrive and simply working off of that, but I have 3 computers and all 3 assign different drive letters to the jumpdrive, which I've read can cause problems.

Anyone have another solution to this? I am working on localhost - I don't have an actual site to set up my tables on and access them that way, but if that's what it takes I can do it. I wondered about SVN or GIT... do they synchronize database tables OK?
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Synchronizing WAMP/MySQL across two local machines?

Post by Jackolantern »

You know how to export a MySQL database, right? phpMyAdmin can automatically recreate your database by writing a huge SQL statement that creates the database again and inserts all data. It can simply be saved into a text file and then imported to any phpMyAdmin installation you like. When I released my PHP/JS map creator a while back I included the SQL dump of the database so people could easily recreate the backing tables.

EDIT: I forgot to mention that the options to do these things are on the tabs in phpMyAdmin labeled Import and Export.
The indelible lord of tl;dr
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Synchronizing WAMP/MySQL across two local machines?

Post by OldRod »

Yeah, I know how to do that, and that's what I'm doing now. But before I can import, I have to clean out the old tables, and as I get more and more, that's taking time. Plus, if I forget to do an export or forget the thumbdrive, then my data/code on my laptop isn't the latest, etc.

I'm just looking for something to make my life easier :)
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Synchronizing WAMP/MySQL across two local machines?

Post by Jackolantern »

What do you mean by cleaning out the tables? What exactly are you having to do to them (I am wondering if you could automate it)? I was wondering if you knew about the Import/Export because you were talking about working with the binary db files, which is rarely necessary. What about running a cron/Windows scheduled task script to export the database and store it on a networked drive?

Or are you looking for an automatic back-up service? Something like Carbonite?
The indelible lord of tl;dr
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Synchronizing WAMP/MySQL across two local machines?

Post by OldRod »

Here's what I want :)

I have 3 computers. A home desktop. A work desktop and a work laptop. They are all running Win7 Ultimate 64bit. Throughout the week, I develop on all three, but I am working with Localhost, not on a hosted site, so the code and data is on the machine I am working on at the time.

I want to keep all three machines synchronized so whatever one I am on has the latest code and data.

What I mean by clearing out the tables... currently I am using a jumpdrive. Each time I move between machines, I export the MySQL and copy that, along with all my code to the jumpdrive. When I get to the other machine, I have to clear out the database before importing the MySQL file into it. If I don't do this, then I get errors because tables/fields exist, etc.

Dropbox works fine for some other things I use it for, so I tried configuring WAMP to put my 'www' and 'data' folders in my Dropbox folder. I don't have any problem with my PHP/CSS/HTML files doing this, but with larger binary files (like MySQL tables) Dropbox can sometimes have problems. So I'm looking for a better solution. And of course, I left my jumpdrive laying on my desk at work this afternoon (20 miles away) so since I can't code tonight, I figured this would be a good time to figure out how to prevent this problem in the future :)
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Synchronizing WAMP/MySQL across two local machines?

Post by Jackolantern »

It really sounds like maybe you should change to a code repository. Beyond being able to instantly download your latest files (including your SQL dumps) wherever you go, you will also get benefits such as keeping track of old versions in case you make breaking changes, or something like that. It would eliminate you having to clear out the old versions from your removable media, since you just add the new version of it. It can also help you keep your project files straight if you begin working with anyone else.

Most decent SVNs aren't free if you want the project to be private, but they really aren't expensive either. For $9 a month on Assembla you get a ton of space for 1 project that is accessible by up to 3 developers. There may very well be a free alternative out there that allows you to make private repositories.
The indelible lord of tl;dr
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Synchronizing WAMP/MySQL across two local machines?

Post by OldRod »

*edit*

After doing lots of researching...

I am just going to write a PHP script that exports my full db to my dropbox folder. Then when I switch machines, I have another PHP script that deletes everything in that DB on the new machine and imports the file from dropbox.

It is just a couple of clicks and as long as I remember to do it, it should work fine. Even if I forget to export it, I can still have my code everywhere I'm working and I'll still have a pretty recent copy of the SQL data, so that should get me by.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Synchronizing WAMP/MySQL across two local machines?

Post by Jackolantern »

If you write that into a script, you could easily set it up to run automatically with Windows Task Scheduler or crons (depending on if you're on Linux or Windows)! 8-)
The indelible lord of tl;dr
Post Reply

Return to “General Development”