zoukankan      html  css  js  c++  java
  • FLUSH TABLES WITH READ LOCK

    会话1:

    mysql> FLUSH TABLES WITH READ LOCK; Query OK, 0 rows affected (0.18 sec) mysql> show processlist; +----+------+-----------------+------+---------+------+----------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------------+------+---------+------+----------+------------------+ | 12 | root | localhost:48850 | NULL | Sleep | 3603 | | NULL | | 13 | root | localhost:48851 | test | Sleep | 2665 | | NULL | | 14 | root | localhost:49828 | NULL | Query | 0 | starting | show processlist | +----+------+-----------------+------+---------+------+----------+------------------+ 3 rows in set (0.00 sec) mysql> use test; Database changed mysql> create table tt( a int); ERROR 1223 (HY000): Can't execute the query because you have a conflicting read lock
    会话2:

    mysql> use test; Database changed mysql> create table tt(a int);



    会话1:

    mysql> show processlist; +----+------+-----------------+------+---------+------+------------------------------+------------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------------+------+---------+------+------------------------------+------------------------+ | 12 | root | localhost:48850 | NULL | Sleep | 3712 | | NULL | | 13 | root | localhost:48851 | test | Sleep | 2774 | | NULL | | 14 | root | localhost:49828 | test | Query | 0 | starting | show processlist | | 15 | root | localhost:49833 | test | Query | 7 | Waiting for global read lock | create table tt(a int) | +----+------+-----------------+------+---------+------+------------------------------+------------------------+ 4 rows in set (0.00 sec)
    1.当退去会话1后,就会自动释放锁,会话2,就可执行
    2.unlock table
  • 相关阅读:
    吴裕雄 python深度学习与实践(1)
    吴裕雄 python 机器学习-Logistic(1)
    吴裕雄 python 熵权法确定特征权重
    【Uva 1252】Twenty Questions
    【玲珑杯 round#18 B】图论你先敲完模板
    【Uva 10817】Headmaster's Headache
    【玲珑杯 round#18 A】计算几何你瞎暴力
    【Uva 12128】Perfect Service
    【UVa 12186】Another Crisis
    【Uva 10003】Cutting Sticks
  • 原文地址:https://www.cnblogs.com/zengkefu/p/5617990.html
Copyright © 2011-2022 走看看