简体   繁体   中英

Exporting sql data from mysql server into csv file in local mac computer Help,

when I attempt to take the data I have from my mysql server and generate a csv file with this command:

select * from table into outfile '/Users/username/Desktop/testfile.csv' fields terminated by ',' enclosed by '"' lines terminated by '/n';

I end up with the error:

ERROR 1 (HY000): Can't create/write to file '/Users/username/Desktop/testfile.csv' (Errcode: 13 - Permission denied)

Another weird problem is I can't seem to stop the server from running through the preference pane, maybe they are related. Anyways, thanks for the help!

Try this:

 SELECT * FROM table INTO OUTFILE '/tmp/myfile.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"';

Then in you terminal, cd to the tmp directory, do ls to see if the file is there and when you are in that tmp directory, just do open myfile.csv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM