mysql -uroot -p -e "use database;sql语句;" > a.csv
举例:
mysql -uroot -p -e "use main;select b.* from point a left join user b on a.user_id = b.id where a.trade_type = 'CLASS' AND a.ctime > '2018-05-28' and a.ctime < '2018-06-01';" > a.csv
mysql -uroot -p -e "use database;sql语句;" > a.csv
举例:
mysql -uroot -p -e "use main;select b.* from point a left join user b on a.user_id = b.id where a.trade_type = 'CLASS' AND a.ctime > '2018-05-28' and a.ctime < '2018-06-01';" > a.csv