Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export table data in MySql Workbench to csv?

I am wondering how do I export table data into a csv? I read that I need to use mysql workbench command line but I can not figure out how to launch the cmd line(don't know what the command is).

Running on Windows 7 64bit.

like image 852
chobo2 Avatar asked Jun 14 '13 17:06

chobo2


People also ask

How do I export data from MySQL to CSV?

Select the table of the database that you want to export and click on the Export tab from the right side. Select the CSV format from the Format drop-down list and click on the Go button. Select the Save File option and press the OK button. The file will be downloaded in the Downloads folder.

How do I import data from MySQL workbench to CSV?

Importing CSV file using MySQL Workbench The following are steps that you want to import data into a table: Open table to which the data is loaded. Review the data, click Apply button. MySQL workbench will display a dialog “Apply SQL Script to Database”, click Apply button to insert data into the table.


2 Answers

You can select the rows from the table you want to export in the MySQL Workbench SQL Editor. You will find an Export button in the resultset that will allow you to export the records to a CSV file, as shown in the following image:

MySQL Workbench Export Resultset Button

Please also keep in mind that by default MySQL Workbench limits the size of the resultset to 1000 records. You can easily change that in the Preferences dialog:

MySQL Workbench Preferences Dialog

Hope this helps.

like image 88
Sergio Avatar answered Sep 21 '22 13:09

Sergio


U can use mysql dump or query to export data to csv file

SELECT * INTO OUTFILE '/tmp/products.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM products 
like image 36
Neeti Avatar answered Sep 18 '22 13:09

Neeti