Home >Database >Mysql Tutorial >What is the concept of mysql exclusive write lock
Explanation
1. Writing operations (adding write locks) to the MyISAM table will block other processes from reading and writing the same table.
2. Only when the write lock is released, the read and write operations of other processes will be performed. No other tables can be written to before the lock is released.
Example
Transaction-A mysql> set autocommit=0; Query OK, 0 rows affected (0.05 sec) mysql> lock table myisam_lock write; Query OK, 0 rows affected (0.03 sec) mysql> update myisam_lock set v='2001' where k='2'; Query OK, 1 row affected (0.00 sec) mysql> select * from myisam_lock; 9 rows in set (0.00 sec) mysql> update innodb_lock set v='1001' where k='1'; ERROR 1100 (HY000): Table 'innodb_lock' was not locked with LOCK TABLES mysql> unlock tables; Query OK, 0 rows affected (0.00 sec)
The above is the detailed content of What is the concept of mysql exclusive write lock. For more information, please follow other related articles on the PHP Chinese website!