Database

Export mysql database based on a where condition

mysql-logo MYSQLDUMP exports data from MySQL databases. It is commonly used to export all data from a table or database, but it can also export selected data using a where condition. Use —where followed by the conditions, as in the examples below: Export data in SQL format

$ mysqldump -uUserName -pYourPassword --databases DATABASE_NAME --tables TABLE_NAME --where='Where cluase conditions' -u root -pYOUR_PASSWORD > data.sql

Export data in 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=, > data.csv
EOF.← Back to articles