mysql to csv without using INTO OUTFILE of mysql

[亡魂溺海] 提交于 2019-12-12 04:24:17

问题


I need to export data from mysql to a csv file with column heading but i dont have file permission on the server. Is there any otherway to do it? i.e. using php fwrite? or fputcsv?

Any help will be much appriciate.

Thanks.


回答1:


If you can connect to the MySQL server, you can run the mysqldump utility, which is capable of generating CSV files. This is far easier than trying to come up with something yourself.

mysqldump --tab --fields-terminated-by="," --host=$SERVER --user=$USERNAME --password=$PASSWORD $DATABASE


来源:https://stackoverflow.com/questions/3835750/mysql-to-csv-without-using-into-outfile-of-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!