|
Last updated: 06/25/2009
It's often useful to make "ad hoc" reports that can be brought into excel or another database as CSV files. You can do this directly from mysql.
First, your user must have the "FILE" privilege - to allow file creation from mysql. If you find you are getting an error like this:
ERROR 1045 (28000): Access denied for user 'xxx@localhost'
then you probably don't have the proper privileges, or you are trying to create a file where you don't have write permissions.
Otherwise, you can dump a csv like so:
select cname,address_line1,address_line2,city,state,zip,fname,lname,phone,email from ss_user into outfile 'user_dump.txt';
You can use any select query - the results will be a tab delimited file by default.
blog comments powered by
|