mysql -u test -ptest -P5606 -Dtest_db -h192.168.8.2 -e "select id,name from test_table" >testData.txt ;
其中:
-u 用户名
-p 密码
-P 端口(如果默认,则为3306)
-D 数据库名称
-h host
-e 要执行的sql语句