tricks

Vài chiêu với MySQL

Posted on Updated on

Xuất file csv bằng command line hoặc sql query

mysql -u user -ppass [database_name] | sed 's/\t/,/g' > out.csv

mysql>...
INTO OUTFILE 'out.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Advertisements