Nov 8, 2018

MySQLdump with where condition

You can add where condition to MySQLdump:

SQL format
$ mysqldump -uUserName -pYourPassword --databases DATABASE_NAME --tables TABLE_NAME --where='Where cluase conditions' -u root -pYOUR_PASSWORD > data.sql
CSV format
$ mysqldump -uUserName -pYourPassword --databases DATABASE_NAME --tables TABLE_NAME --where='Where cluase conditions' -u root -pYOUR_PASSWORD --fields-enclosed-by=\" --fields-terminated-by=, --tab=path

path pointed by --tab needs to be able to be written by user 'mysql'.