Native format of MySQL export tables is supported by a limited number of applications. Therefore, it is reasonable to export the data into more common format like comma seoarated values (CSV).
This whitepaper explores four different methods of export MySQL tables into CSV format:
This is a tool included in the MySQL installation that has been designed to export individual tables and entire databases. It is also can be used for backup and recovery. Use the following command line to export MySQL to CSV through mysqldump:
mysqldump -u {username} -p -t -T{path to output folder} {database} {table name} --fields-terminated-by=,
This command will export the table {table name} of {database} at the location specified by the -T option. Of course, all placeholders in figure brackets must be replaced by actual values.
phpMyAdmin provides a graphical user interface to perform miscellaneous administration tasks over MySQL databases. For instance, it can export MySQL data into CSV, XML, JSON, YAML and many others formats. You can Export MySQL tables into CSV files using phpMyAdmin as follows:
Import/Export Wizard provided by MySQL Workbench allows to export the database or some tables into the specified format. The wizard provides easy-to-use graphical interface and supports CSV format.
Follow these steps to export MySQL to CSV using MySQL Workbench:
MySQL CSV storage engine uses comma-separated values format to store table data. This engine is always compiled into the server. Remember that this method of export MySQL to CSV can be applied to tables without indexes and AUTO_INCREMENT constraint.
Use the following command to change the format of the storage engine to CSV:
ALTER TABLE {table name} ENGINE=CSV;
Then the related CSV file can be copied to another database management system directly.
Have questions? Contact us