Exporting a MySQL database to CSV is something developers, analysts, and website owners do all the time. Whether you want to open your data in Excel, share it with a client, or move it to another system — this guide shows you exactly how to do it in 4 simple ways.
Why Export MySQL to CSV?
CSV is the most universal data format in the world. Every spreadsheet tool, analytics platform, and database system can read it.
Common reasons to export MySQL to CSV:
- Open database data in Excel or Google Sheets
- Share data with clients or team members
- Import data into another system or software
- Analyse data using Python, R, or Tableau
- Create a readable backup of specific tables
Method 1 — Online Converter (Easiest, No Setup)
This is the fastest method. No command line, no software, no technical knowledge needed.
- Go to https://dbconverter.site/sql-to-csv
- Upload your MySQL .sql dump file
- Select CSV as the target format
- Click Convert and download your file
Done in under one minute. Free, no account needed, file deleted automatically after two hours.
👉 Export MySQL to CSV free: https://dbconverter.site/sql-to-csv
Method 2 — Using phpMyAdmin
If you use shared hosting like cPanel or Hostinger, you already have phpMyAdmin.
- Open phpMyAdmin and select your database
- Click the table you want to export
- Click the Export tab
- Choose Custom and set format to CSV
- Tick Put column names in the first row
- Click Go — your CSV downloads immediately
To export the whole database, click the database name instead of a single table, then follow the same steps. Each table exports as a separate CSV inside a ZIP file.
Method 3 — Using Command Line
Best for large databases or automated exports.
Export a full table to CSV:
mysql -u your_username -p your_database -e "SELECT * FROM your_table" | sed 's/\t/,/g' > output.csv
Export with proper formatting:
SELECT * FROM your_table
INTO OUTFILE '/tmp/output.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
Export only specific rows:
SELECT * FROM orders
WHERE created_at >= '2026-01-01'
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
Method 4 — Using MySQL Workbench
MySQL Workbench is a free desktop tool from Oracle with a visual interface.
- Open MySQL Workbench and connect to your database
- Run this query:
SELECT * FROM your_table_name; - In the results panel click the Export icon
- Select CSV and choose where to save your file
To export specific columns only, write SELECT id, name, email FROM your_table instead of SELECT *.
Common Problems and Quick Fixes
Special characters look wrong — Use UTF-8 encoding when exporting and importing.
Dates formatted incorrectly in Excel — Use Excel's Import option and set the date column format manually.
Numbers with leading zeros disappear — During Excel import set those columns to Text format.
File too large for Excel — Export in chunks using date ranges in your WHERE clause.
Have a .sql file and need CSV — Upload it to DBConverter and convert instantly.
How to Open CSV in Excel
Double-click the file — Excel opens it automatically. For large files use Data → Get External Data → From Text/CSV for better control.
How to Open CSV in Google Sheets
Go to File → Import → Upload, select your CSV file, set separator to Comma, and click Import Data.
Frequently Asked Questions
Can I export specific columns only? Yes. Use SELECT column1, column2 FROM your_table instead of SELECT *.
Can I export multiple tables into one CSV? Not directly. Write a JOIN query that combines the tables first, then export the result.
Is my data safe with an online converter? Yes. DBConverter processes your file and deletes it automatically within two hours. No account required.
Can I automate MySQL to CSV exports? Yes. Use the command line method with a cron job on Linux or Task Scheduler on Windows.
Conclusion
Here is a quick summary of which method to use:
- Fastest — DBConverter online, no setup needed
- Shared hosting — phpMyAdmin, takes 2 minutes
- Large databases — Command line with SELECT INTO OUTFILE
- Visual tool — MySQL Workbench
All four methods give you a clean CSV file ready for Excel, Google Sheets, or any analytics tool. If you have a MySQL dump file and need CSV right now, DBConverter does it in under one minute — completely free.
👉 Export MySQL to CSV free: https://dbconverter.site/sql-to-csv
👉 Need Excel, JSON or SQLite instead? https://dbconverter.site/convert