MySQL5.7查锁及解锁
#查询库中是否锁表
mysql> show open tables where in_use<>0 and name_locked=0;
+----------+--------+--------+-------------+
| Database | Table | In_use | Name_locked |
+----------+--------+--------+-------------+
| test | my_tab | 1 | 0 |
+----------+--------+--------+-------------+
1 row in set (0.00 sec)
#解锁表
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)
#再次确认是否缩表
mysql> show open tables where in_use<>0 and name_locked=0;
Empty set (0.00 sec)
#根据info中的sql,大范围模糊查询该id
mysql> show processlist;
+----+------+-----------+--------------------+---------+------+----------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+--------------------+---------+------+----------+------------------+
| 2 | root | localhost | information_schema | Query | 0 | starting | show processlist |
+----+------+-----------+--------------------+---------+------+----------+------------------+
1 row in set (0.03 sec)
#杀进程
mysql> kill 2;
ERROR 1317 (70100): Query execution was interrupted