2

I'm a first-time XAMPP user and was wondering what is the method of making sure my local test MySQL database is synced with the live remote database. Or, how do I 'push' the local database to the live server?

With HTML files I suppose a FTP program is all I need. But I don't know what to do about the database. Thanks.

2 Answers 2

2

Keeping two databases in sync is known as "replication". MySQL supports database replication. In fact one of their use cases seems to match yours pretty well:

Long-distance data distribution - if a branch office would like to work with a copy of your main data, you can use replication to create a local copy of the data for their use without requiring permanent access to the master.

They have a guide for how to set up replication.

2
  • So, if I edit the local copy I can pass on the changes to the remote copy using replication?
    – posfan12
    Commented Jan 8, 2015 at 13:12
  • Yes, replication takes changes from one location and replays them in other to keep two databases in sync. Commented Jan 8, 2015 at 13:48
1

There are hundreds of variations to development workflow and what you use should be tailored to what you need and how you work.

XAMPP offers the ability to develop locally. It doesn't provide an ability to push those changes to a live server or sync between the two. Many text editors will provide you with the ability to push changes live (such as Sublime Text 3) or many will use version control software such as Git which caters for multi-collaboration and makes it easy to roll back to previous changes or prevent major issues when making changes to a website. It goes hand in hand with other local development processes though. And then, the likes of Github or Gitlab host your repositories. You can even use deployment software such as deployhq.com to then deploy the code from your repository.

As said, there are countless ways and it is down to you to set up your ideal and preferred development workflow. If it is just you working on your projects, then with XAMPP set up locally, just using a text editor that allows you to upload to the server should suffice for what you need.

2
  • I know for text files I can just use FTP. But for the database specifically I don't know what to do other than dumping and restoring the whole thing every time.
    – posfan12
    Commented Jan 7, 2015 at 23:30
  • Depends on how you are working and what the database structure / platform you are building on. You can quickly dump and import databases over the command line or write a script that performs the necessary actions automatically and run it on a cron. It's not really easy to advise you seeing we don't know your specific scenario.
    – zigojacko
    Commented Jan 8, 2015 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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