mysql command to export database table to csv 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';