简体   繁体   English

从mysql服务器将sql数据导出到本地mac电脑帮助中的csv文件中,

[英]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: 当我尝试从mysql服务器获取数据并使用以下命令生成csv文件时:

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 然后在终端中,cd到tmp目录,执行ls以查看文件是否存在,并且当您位于该tmp目录中时,只需打开myfile.csv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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