Home >Database >Mysql Tutorial >mysql导出到csv文件报错

mysql导出到csv文件报错

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:34:031712browse

select * from students into outfile '/tmp/test.csv' fields terminated by ',' optionally enclosed by '' escaped by '' lines terminated by '\r\n'; 执行后产生错误: ERROR 1 (HY000): Can't create/write to file '/home/trial/yqj/sql/test.csv' (E

 select * from students into outfile '/tmp/test.csv' fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';

执行后产生错误:

ERROR 1 (HY000): Can't create/write to file '/home/trial/yqj/sql/test.csv' (Errcode: 13)

经过网上搜索,原来是权限问题,/home/trial/yqj/sql/整个目录的权限必须都是可写的,后来改成

select * from students into outfile '/tmp/test.csv' fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';就好了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn