1、方法一
mysql -uroot -p -h10.250.xxx.xxx app -A -e"select * from b left join a on b.fee_no = a.fee_no and a.mtenant_id = b.mtenant_id where a.mtenant_id = '153070' and a.status = '02' and a.create_time >= '2023-11-01 00:00:00'" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' >>outfile.csv
2、方法二
–secure-file-priv 参数
SELECT columnName, ...
FROM tableName
WHERE columnName = 'value'
LIMIT 1000
INTO OUTFILE 'path/outputFile.csv'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY ''
LINES TERMINATED BY '\n';