mysql table lock mechanism (read and write)

I found a giant artificial intelligence learning website a few days ago, which is easy to understand and humorous. I can’t help but share it with everyone. Click to jump to the tutorial.
Separate read locks and write locks from database operation types
. Separate table locks and row locks from the granularity of database operations.

Read lock (shared lock): For the same piece of data, multiple read operations can be performed at the same time without affecting each other.
Write lock (exclusive lock): Before the current write operation is completed, it will block other write locks and read locks.

Read lock experiment:

create table mylock(
	id int not null primary key auto_increment,
	name varchar(20)

Guess you like

Origin blog.csdn.net/huangbaokang/article/details/113538790