SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
SET GLOBAL tx_isolation='READ-COMMITTED';
SET SESSION tx_isolation='READ-COMMITTED';
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
SELECT * FROM users WHERE uid = 1 FOR UPDATE;
COMMIT;
# vim /etc/my.cnf
[mysqld]
transaction-isolation = READ-COMMITTED
Reference:
https://dev.mysql.com/doc/refman/5.5/en/set-transaction.html
https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation
https://www.percona.com/blog/2012/03/27/innodbs-gap-locks/
No comments:
Post a Comment