views:

26

answers:

2

Hi All, I am using MySql as a development database as well as on the server where my website is hosted. Now everday I punch new data into the database and save it as SQL dump using SQLyog. But when it comes to updating the data for that day on the server Mysql database I have to truncate the tables and then insert the new data. Which leads to following concerns :

  1. Data being 5000+ rows in each table the insert query fails to execute. So I have to insert data in batches of 2000 rows.

  2. For the time when I truncate a particular table and the new data is not yet inserted any request on the website will result in no data at all. Which is 5 to 7 minutes.

  3. Everyday only around 300 rows are added into each table but I have to insert the complete data for a table.

Please sugges how can I take incremental backup of my local MySql database so I can update the same on the server and not the complete data till that day. Please help it is now killing me. Thanks to all.

regards

A: 

Why don't you just use command line dump and restore as follows -

To create dump -

mysql -u root -h localhost -p db_name > db_name_dump_version.sql

This will dump the DB to the file db_name_dump_version.sql

Then to restore from it -

mysql -u root -h localhost -p db_name < db_name_dump_version.sql

Command line mysql is blitzingly fast so you won't have to wait more than 10 seconds for even a million row DB.

arunabhdas
A: 

If it's a simple development environment, I actually wouldn't recommend going the incremental dump route. AFAIK, mysql doesn't provide a built in way to do this. If you really want to do this, you could use the binary log. Using the binary log to replay the statements from the following day. Internally, MySQL uses the binary log for replication. (Disclaimer, I've never done this before, and I'm pretty sure you'll run into problems if you've inserted or deleted from your development copy.)

Alternatively, you could just create another database every, import the dump into that, and reconfigure your app to use the new db. Once you've reconfigured, drop yesterday's DB, and you're good. No downtime...

Chris Henry