直接查数据导出xls
/usr/bin/mysql --default-character-set=utf8 -uroot -p"123456" -e"select * from test_db.test_table">/tmp/1.xls
或者
select aid,username into outfile "/xxx.xls" from testtable where cid in($str);
或者
select aid,username from testtable where cid in($str) into outfile "/xxx.xls" ;