MySQL中InnoDB锁不住表的原因

MySQL中InnoDB锁不住表是因为如下两个参数的设置:

mysql> show variables like '%timeout%';

+-----------------------------+----------+

| Variable_name               | Value    |

+-----------------------------+----------+

| connect_timeout             | 10       |

| delayed_insert_timeout      | 300      |

| innodb_flush_log_at_timeout | 1        |

| innodb_lock_wait_timeout    | 50       |

| innodb_rollback_on_timeout  | OFF      |

| interactive_timeout         | 1800     |  #默认是1800

| lock_wait_timeout           | 31536000 |

| net_read_timeout            | 30       |

| net_write_timeout           | 60       |

| rpl_stop_slave_timeout      | 31536000 |

| slave_net_timeout           | 3600     |

| wait_timeout                | 1800     |  #默认是1800

+-----------------------------+----------+

mysql> set  wait_timeout=60;  #修改参数

mysql> set interactive_timeout=60;

mysql> show variables like 'wait_timeout';

+--------------------------+----------+

| Variable_name            | Value    |

+--------------------------+----------+

| wait_timeout             | 60       |

+--------------------------+----------+

mysql> show variables like '%interactive_timeout%';

+---------------------+-------+

| Variable_name       | Value |

+---------------------+-------+

| interactive_timeout | 60    |

+---------------------+-------+

mysql> flush tables with read lock;  #锁表

mysql> unlock tables;  #解锁

上一篇:UCL 教授汪军:多智能体强化学习的两大挑战 | CCF-GAIR 2017


下一篇:mysql中把一个表的数据批量导入另一个表中