Tuesday, May 21, 2013

mysql dump to a file with where clause

This is very useful to export records in a table to a file, to import later...


mysqldump --databases dbname -h hostname --tables tablename --where="condition='1' and condition='2'" -u username -p --no-create-db --no-create-info > myfile.dump

to import

mysql --databases dbname -h hostname --tables tablename -u username -p < myfile.dump

No comments:

Post a Comment