Convert sql to csv
来自cslt Wiki
1. create database and load sql to it.
a) create database <database_name> b) use <database_name> c) source <xxx.sql>
2. obtain the column names and save csv.
a) select group_concat(concat("'",column_name,"'")) from information_schema.columns where table_name = '<table_name>'; b) select <column_string> union all select * from <table_name> into outfile '/var/lib/mysql-files/xxx.csv' fields terminated by ',' optionally enclosed by '"' escaped by '\\' lines terminated by '\n';
3. replace \N with in csv.
a) sed -i 's/\\N//g' xxx.csv