Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strategies for copying data from a live MySQL database to a staging server

Tags:

mysql

I have a live MySQL DB which is too large to regularly copy the live data to the staging server.

Is there a way of getting just the changes from the last week with the intention of running that script weekly? Would every table have to have an updated timestamp field added to it to achieve this?

like image 905
bcmcfc Avatar asked Oct 19 '11 13:10

bcmcfc


People also ask

Can I copy MySQL data directory to another server?

You have to shut down mysql server (which is not good, if it's a production server) You have to make sure the permission of data (mysql) directory is same as the previous one. You will have to monitor the mysql_error log while starting the second server.

How do databases connect to staging?

To Connect to the Staging DatabaseRight-click Virtual DB, and then select Connect Using. On the New Database Connection dialog box, fill in the following fields: Database URL – The URL to the staging database in this format: jdbc:axiondb: DatabaseName : DatabaseLocation .


1 Answers

I don't know how large "too large to regularly copy" is, but I use SQLyog to synchronize databases. It intelligently does insert/update/deletes for only the records that have changed. I recommend it highly.

like image 108
Sonny Avatar answered Oct 14 '22 01:10

Sonny