#只運行,不導出 mysql> source /home/user/to_run.sql; #導出 $ mysql -h host -u user -ppassword database < to_run.sql | sed 's/\t/,/g' > out.csv或者$ mysql -h host -uUSER -pPASSWORD --default-character-set=utf8 -A DATABASE -e 'select id from DATABASE.TABLE order by id;' > /tmp/XXX.csv