Description:
Execute following queries, will cause new connection stuck.
session A:
create database test;
create table t1(a int);
lock table t1 write;
session B:
create database test; // the query is stuck
now connect mysql with database test, the connection is stuck:
mysql -uroot -p123456 -h127.0.0.1 -P3306 test
see Id 126
MySQL [information_schema]> show processlist;
+-----+-----------------+-----------------+--------------------+----------+-------+----------------------------------+----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+-----------------+-----------------+--------------------+----------+-------+----------------------------------+----------------------+
| 5 | event_scheduler | localhost | NULL | Daemon | 12583 | Waiting on empty queue | NULL |
| 8 | root | localhost:50266 | NULL | Sync msg | 12582 | starting | NULL |
| 123 | root | localhost:47044 | information_schema | Query | 0 | init | show processlist |
| 124 | root | localhost:55510 | NULL | Query | 388 | Waiting for schema metadata lock | create database test |
| 125 | root | localhost:55540 | test | Sleep | 391 | | NULL |
| 126 | root | localhost:55594 | NULL | Connect | 363 | Waiting for schema metadata lock | NULL |
+-----+-----------------+-----------------+--------------------+----------+-------+----------------------------------+----------------------+
How to repeat:
see Description