mysql export query code example
Example 1: how to export db from mysql
mysqldump -u username -p dbname > dbexport.sql
Example 2: mysql export query result to csv
SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/var/lib/mysql-files/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
Example 3: mysql export database command line
mysqldump --databases --user=root --password your_db_name > export_into_db.sql