MySQL查询结果保存到本地

#!/bin/bash
mysql -h<公网IP> -P<端口号> -u<用户名> -p<密码> -D<指定数据库> >/Users/admin/Downloads/abc.txt <<EOF 
select count(*) from table_name
EOF
原文地址:https://www.cnblogs.com/36bian/p/5714555.html