Home > Database > Mysql Tutorial > What is the concept of mysql exclusive write lock

What is the concept of mysql exclusive write lock

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-05-29 09:07:05
forward
834 people have browsed it

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)
Copy after login

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!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template