Mysql 导出 excel

导出命令:

select * into outfile '/output.xls' from tables;

如果导出报错:

ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement

说明权限问题,需要导出到指定目录,通过命令查看目录:

show variables like '%secure%';

执行后可以看到需要导出到/var/lib/mysql-files目录下,所以修改导出命令为:

select * into outfile '/var/lib/mysql-files/output2.xls' from cob_order;

发表评论

电子邮件地址不会被公开。 必填项已用*标注