MySQL SELECT INTO OUTFILE to a different server?

早过忘川 提交于 2019-11-29 07:12:04

select into outfile can only create the file on the server, not the client.

Here's what the manual recommends for your situation:

If you want to create the resulting file on some client host other than the server host, you cannot use SELECT ... INTO OUTFILE. In that case, you should instead use a command such as mysql -e "SELECT ..." > file_name to generate the file on the client host.

http://dev.mysql.com/doc/refman/5.1/en/select.html

ASHIQ KT

Use the command below:

mysql -uusername -ppassword -h DBIP DBNAME -e \
"SELECT * FROM tablename" > /destinationpath/outputfilename.csv
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!