PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

mysql导出到csv文件报错

原创
2016-06-07 15:34:03 1478浏览

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';就好了

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。