Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fb7428e

Browse files
mysql锁机制
1 parent cd812f2 commit fb7428e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎My ISAM表锁/共享读锁‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,10 @@ MyISAM表的读操作与写操作之间,以及写操作之间是串行的!
3838
一个session使用LOCK TABLE命令给表f加了读锁,这个session可以查询锁定表中的记录,但更新或访问其他表都会提示错误;
3939
同时,另外一个session可以查询表中的记录,但更新就会出现锁等待。
4040

41+
****************************************************************************************************
42+
共享读锁
43+
1.一个session使用LOCK TABLE命令给表加了读锁,这个session可以查询锁定表中的记录,但更新或访问其他表都会提示错误
44+
2.当使用LOCK TABLES时,不仅需要一次锁定用到的所有表,而且,同一个表在SQL语句中出现多少次,就要通过与SQL语句中相同的别名锁定多少次,
45+
否则也会出错!
46+
lock table 表名 as 别名 read;
4147

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /