将mysql的查询结果保存到文件中,并将文件从内网下载到外网服务器
方法一:
直接执行命令:
mysql> SELECT ordersid from yws.callback_clockd ORDER BY ordersid ASC limit 0,1000000 into outfile '/var/lib/mysql-files/callback_clockd.xls';
方法二:
跳出mysql命令行
mysql -h 127.0.0.1 -u root -p XXXX -P 3306 -e "select * from table" > /tmp/test/txt
下载:scp root@192.168.1.200:/var/lib/mysql-files/callback_clockd.xls /
本文来自博客园,作者:飞龙在生,转载请注明原文链接:https://www.cnblogs.com/flzs/p/11302518.html