Is there a way to hide or export the entire MySQL database into valid CSV files?

I work with a large 1.5 gigabyte database and hundreds of tables / fields. I need to convert all tables to CSV files. PhpMyAdmin does not make it easy / time.

I would prefer to use the shell / mysql command or script to output the data in CSV too.

Note:

I want to export ALL database tables - in 1 snapshot. I can not execute the export command for each individual table separately.

+3
source share
3 answers

You can use mysqldump:

The command mysqldumpcan also generate output in CSV, another separator text, or XML format.

In particular, consider the following arguments:

+2

, . .

SELECT *
INTO OUTFILE '/tmp/products.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
FROM products

, MySQL. , :

#1 - Can't create/write to file '/tmp/products.csv' (Errcode: 13)

, , , :

#1086 - File '/tmp/products.csv' already exists

: http://www.electrictoolbox.com/mysql-export-data-csv/

+1

All Articles