Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14625 reviews 1734 hosting providers

Questions & Answers

Exporting MySQL Data to a spreadsheet

Apr 26, 2012 by A007
Greetings all,

I have a wordpress website connected to MySQL database. I need to move data out of MySQL database into a .csv spreadsheet to send to someone else. But I’m not sure how to do it. Can anybody advice?
Note: I’m using a windows os

thank you

1 Answer

0 votes
Apr 26, 2012 by FixHost
The syntax below, will create a comma separated file at the disk location indicated.
Double-click on the file and it will open in Excel or any other application associated with the .csv extension.
SELECT lname,fname,address,email
INTO OUTFILE 'd:/CurrentCustomers.csv'
FROM customers
WHERE STATUS = 'current'
ORDER BY lname,fname;