将mysql查询的输出发送到csv文件时出错 [英] Error while sending output of a mysql query to a csv file
本文介绍了将mysql查询的输出发送到csv文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮助我进行以下查询吗,我还很新
could somebody help me with the following query, I am pretty new
SELECT * FROM information_schema.columns Where TABLE_SCHEMA='test';
INTO OUTFILE 'file.csv';
FIELDS TERMINATED BY ',';
谢谢.
推荐答案
SELECT * FROM information_schema.columns Where TABLE_SCHEMA='test'
INTO OUTFILE 'file.csv'
FIELDS TERMINATED BY ',';
为什么在所有行中都提到;
?
Why have you mentioned ;
this in all the rows??
MySQL可能正在将文件写入其自己的数据目录,例如
例如/var/lib/mysql/<databasename>
.要指定路径,请使用完整路径.
MySQL may be writing the file into its own data directory, like
/var/lib/mysql/<databasename>
for example. To specify the path, use a full path.
但是,它必须是运行MySQL服务器守护程序的用户帐户可写的目录. 因此,我将经常使用/tmp:
However, it must be a directory that is writable by the user account the MySQL server daemon is running under. For that reason, I'll often use /tmp:
指定要写入的路径,如下所示:
Specify the path you want to write to as in:
INTO OUTFILE '/tmp/mydata.csv'
这篇关于将mysql查询的输出发送到csv文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文