【MySQL】テーブルをそのままCSVに出力する。

自分用めも。

文法。

select * from [DB名].[テーブル名] into outfile "/path/to/output/fileName.csv" fields terminated by ',' enclosed by '"' lines terminated by '\r\n';

例。

select * from mysql.help_topic into outfile "/home/admin/output.csv" fields terminated by ',' enclosed by '"' lines terminated by '\r\n';

一発で生成可能。さすがMySQL。めっちゃ便利。