[c-dag002 pang]$ mysql -hprod-ai.mysql.rds.aliyuncs.com -P5000 -udba -pdq4Xy -D device -e "select * from t_tencent_statistic where create_time < '2022-05-14 00:00:00' " > t_tencent_statistic.txt
mysql: [Warning] Using a password on the command line interface can be insecure.
Killed
[cloud-user@m2m-ags-biz-dag002 pang]$ free -h
total used free shared buff/cache available
Mem: 45G 30G 12G 2.8M 2.8G 15G
Swap: 0B 0B 0B
[clous-biz-dag002 pang]$ mysql -hprod-ai.mysql.rds.aliyuncs.com -P5000 -udba -pJqdq4 -D device --quick -e "select * from t_tencent_statistic where create_time < '2022-05-14 00:00:00' " > t_tencent_statistic.txt
mysql: [Warning] Using a password on the command line interface can be insecure.
[cloud-user@m2m-ags-biz-dag002 ~]$ free -h
total used free shared buff/cache available
Mem: 45G 30G 281M 2.9M 15G 15G
Swap: 0B 0B 0B
[cloud-user@m2m-ags-biz-dag002 ~]$ free -h
total used free shared buff/cache available
Mem: 45G 30G 285M 2.9M 15G 15G
Swap: 0B 0B 0B
[cloud-user@m2m-ags-biz-dag002 ~]$ cd pang/
当查询大表时,本地服务器上的内存被占满时,查询进程会备份系统kill 掉。
解决方法就是 使用 --quick 参数 该参数确保内存不被占满。
By default the entire result set is fetched in memory. If that becomes to much, the mysql client will be killed. You can start the mysql client with the --quick
option to prevent this:
mysql --quick -uname -ppwd wmap -e ...
Follow