Killer proprement une connexion en état "Locked" dans MySql
Par zokar le mercredi, juillet 13 2011, 11:07 - Sysadmin - Lien permanent
Petit billet / mémo pour killer proprement une connexion marquée comme Locked dans MySQL
Tout d'abord, voyons comment identifier une session Locked Connexion à MySQL:
root@madb> mysql --defaults-file=/etc/mysql/debian.cnf Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8488 Server version: 5.1.44-ndb-7.1.4b (Debian) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show processlist; +------+------------------+-----------+------+---------+---------+-----------------------------------------------------------------------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +------+------------------+-----------+------+---------+---------+-----------------------------------------------------------------------------+------------------+ | 1 | system user | | | Daemon | 0 | Waiting for event from ndbcluster | NULL | | 3 | system user | | NULL | Connect | 3186221 | Slave has read all relay log; waiting for the slave I/O thread to update it | NULL | | 8 | mon_user | | madb | Query | 34735 | Locked | SELECT * from ma | | 8466 | debian-sys-maint | localhost | NULL | Query | 0 | NULL | show processlist | +------+------------------+-----------+------+---------+---------+-----------------------------------------------------------------------------+------------------+ 4 rows in set (0.00 sec)
On peut voir que la connexion n°8 est en état "Locked".
Pour la stopper :
mysql > kill connexion 8;
Et voilà ! Adieu la vilaine connexion
A bientôt pour un nouveau billet
Commentaires
On peut même faire plus simplement :
mysql> kill 8;
Est ce que je peux reprendre quelques lignes de ce post (en citant votre blog bien évidemment) : j'ai trouvé ça vraiment agréable à parcourir. :D Bonne continuation à vous!
Ps : écrivez moi par mail si vous souhaitez.