Export MySQL data to CSV with phpMyAdmin

Comma-separated values files – also known as CSV’s – are one of the most recognized and used data storage/exchange formats. Whether a CSV is the best choice or not remains to be seen. For some data, a CSV is fine. For others, not so much. At some point, chances are someone will need data from a MySQL database in CSV format. That’s not at all difficult and there are several ways to do that. What if you are working in the phpMyAdmin interface? Can you export CSV’s from the phpMyAdmin environment? You sure can. Continue reading to see simple examples of exporting MySQL table data to a CSV file using phpMyAdmin…

a pile of paper tickets with different numbers
Photo by Pop & Zebra on Unsplash

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

Need to import CSV data into a MySQL table using phpMyAdmin? Not sure how to do it? I wrote Import CSV file data into MySQL table with phpMyAdmin just for you! Be sure and check it out.

I have this table of data, storing different brands of shoes I wear on my many walks and hikes. (Yes, I am finicky about my footwear.)

phpMyAdmin table data
Current table data for export…

Suppose I want to export this table’s data to a CSV file using phpMyAdmin?

Here are the steps:

  1. Click the Export tab.
  2. Under the Export method: section select the Quick – display only the minimal options radio circle.
  3. In the Format: section, choose CSV from the drop-down.
  4. In the Rows: section, click the Dump all rows radio circle (if it is not already selected by default).
  5. Finally, click the Go button and the table rows will be exported to a CSV.

Having followed the above steps, your screen should look similar to mine captured in the picture below:

phpMyAdmin quick export method for CSV files
Quick Export Method for CSV files in phpMyAdmin

The below image captures the fruit of our labor, a CSV file with the exported table data:

CSV data rows
Successful CSV export with no column names.

You may have noticed that the CSV file does not contain a first row of column names. If you need the first row of column names as part of the export, you can change up the export options ever so slightly and have those column names in the first row of the CSV file.

The additional steps are covered below:

  • In the Export method: area, select the Custom – display all possible options radio circle instead of Quick – display only the minimal options.
  • phpMyAdmin custom export method for CSV format
    Custom selection for the Export method in CSV format…
  • At the Format-specific options: section, check the Put column names in the first-row checkbox as shown in the provided screenshot below.
  • phpMyAdmin format-specific options
    Choosing the option for column names in the first row of CSV export.
  • Once again, to execute the Export, click the Go button.

Upon completing that export and looking at the CSV file contents, we can see now the first row contains the column names:
CSV data with rows and column names
Successful CSV export with column names in the first row…

Similar Posts

I mentioned in the post opener, that exporting MySQL table and query results to a CSV file are nothing new – as I am sure you are well aware. However, if you do not have access to phpMyAdmin, you can use SELECT INTO OUTFILE syntax and write to a CSV file just the same. Unsure how to do that? Not to worry. I have previously blogged on this very topic. See the post, MySQL SELECT INTO Syntax Part 2 – Saving to OUTFILE with examples, for more information.

phpMyAdmin provides many export options. CSV files are just one of them. You can expect to see more blog posts covering some of the other formats in the future. Be sure and subscribe to Digital Owl’s Prose so you don’t miss them!

Like what you have read? See anything incorrect? Please comment below and thanks for reading!!!

A Call To Action!

Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.

Visit the Portfolio-Projects page to see blog post/technical writing I have completed for clients.

Have I mentioned how much I love a cup of coffee?!?!

To receive email notifications (Never Spam) from this blog (“Digital Owl’s Prose”) for the latest blog posts as they are published, please subscribe (of your own volition) by clicking the ‘Click To Subscribe!’ button in the sidebar on the homepage! (Feel free at any time to review the Digital Owl’s Prose Privacy Policy Page for any questions you may have about: email updates, opt-in, opt-out, contact forms, etc…)

Be sure and visit the “Best Of” page for a collection of my best blog posts.

Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, is performed on a personal development/learning workstation-environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.

3 thoughts on “Export MySQL data to CSV with phpMyAdmin

Hey thanks for commenting! Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.