Mysql
 sql >> Database >  >> RDS >> Mysql

Shell Script per uccidere automaticamente i processi di sospensione di MySQL

Ce l'ho fatta.

Crea il file kill_sleep.sh

mysql -u<user> -p<password> -h<host> -e "select concat('KILL ',id,';')  into outfile '/tmp/sleep_processes.txt' from information_schema.processlist where Command = 'Sleep'"
mysql -u<user> -p<password> -h<host> -e "source /tmp/sleep_processes.txt;"
rm -rf /tmp/sleep_processes.txt

E imposta kill_sleep.sh su cron job .