Ians Ramblings Ian's ramblings, daily, ish

10Nov/090

MySQL Selective Dump

This is just something I was wondering about, whether I could back up specific rows I am going to modify during test, so I can re-insert them all after I have finished and deleted my test data.

To selectively dump just specifc rows from your mysql table you can use the following:

mysqldump --where=domain_id='7' -t -umyueser mydatabase mytable > mydumpfile.sql

Omitting the "-t" option will also place the drop and re-create table SQL into your dumpfile. It can be handy if you just want to backup a specific set of data from your db. Note it does not create REPLACE INTO's though so you would need to delete the matching rows before restoring from such a dumpfile.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.

6 visitors online now
6 guests, 0 members
Max visitors today: 8 at 06:38 am UTC
This month: 8 at 03-09-2010 10:50 am UTC
This year: 21 at 02-25-2010 11:24 am UTC
All time: 21 at 02-25-2010 11:24 am UTC