mysql shared lock (S lock) and an exclusive lock (X lock)

  mysql table level lock, and it can be divided into row-level locks. Here the record about row-level locking.

  Check whether the database automatically submit the transaction:

. 1  - the ON to OFF to turn off 
2 Show Variables like  ' %% the autocommit '; 
. 3  - set to open automatically submit the transaction 
. 4  SET   the autocommit = . 1 ;
 . 5  - Set off automatically commit the transaction 
. 6  SET the autocommit =  0 ;

  In the case of only two transactions have a lock with a shared lock (S-lock) will not cause obstruction.

  

- MySQL shared locks on 
the SELECT ... Lock in report this content share the MODE;

- MySQL plus exclusive lock on 
the SELECT ... for  Update ;

- common query mechanism does not lock 
the SELECT ...;

  As a transaction acquires an exclusive lock rows of data, other transactions can no longer acquire other locks of the line. (No locking mechanism can query or query.)

Guess you like

Origin www.cnblogs.com/dengsheng/p/11096176.html