说明
1、MyISAM表的读操作(添加读书锁)不会阻止其他过程对同一表的读操作,但会阻止同一表的写作操作。
2、只有读锁释放后,才能执行其他过程的写作操作。锁释放前不能取其他表。
实例
Transaction-A mysql> lock table myisam_lock read; Query OK, 0 rows affected (0.00 sec) mysql> select * from myisam_lock; 9 rows in set (0.00 sec) mysql> select * from innodb_lock; ERROR 1100 (HY000): Table 'innodb_lock' was not locked with LOCK TABLES mysql> update myisam_lock set v='1001' where k='1'; ERROR 1099 (HY000): Table 'myisam_lock' was locked with a READ lock and can't be updated mysql> unlock tables; Query OK, 0 rows affected (0.00 sec)
以上是mysql怎么共享读锁的详细内容。更多信息请关注PHP中文网其他相关文章!