????1.MySQL????autocommit??????????1????0???????
???????????????У???????????????????autocommit ????? 0
???????????????????????????????????????????????????????rollback??
??????????????????????
????set @@autocommit=0;
????????????????????????? my.cnf ????????2???
????[mysqld]
????autocommit=0
????????mysqld ??????Ч
????mysql> select @@autocommit;
????+--------------+
????| @@autocommit |
????+--------------+
????| 0 |
????+--------------+
????1 row in set (0.00 sec)
????mysql> show variables like 'autocommit'
????-> ;
????+---------------+-------+
????| Variable_name | Value |
????+---------------+-------+
????| autocommit | OFF |
????+---------------+-------+
????1 row in set (0.01 sec)
????mysql>
????2.MySQL????tx_isolation????????????????????????????
????mysql ??????????? REPEATABLE-READ
????mysql> select @@global.tx_isolation;
????+-----------------------+
????| @@global.tx_isolation |
????+-----------------------+
????| REPEATABLE-READ |
????+-----------------------+
????1 row in set (0.00 sec)
????mysql ???????4???????
????1.????? (read uncommited);
????2.?????? (read commited);
????3.??????? (Repeatable read);
????4.?????л? (Serializable);
???????????????У?????????????????????????????????£?
????1.???????????????????£????????ó?
????transaction-isolation=read-commited
????2.?????????????ó????????????????
????transaction-isolation=Repeatable-read
???????????????????????????????????????????к??????????????????????
????transaction-isolation=Serializable
????3.??MySQL??????????Щ?????
??????mySQL ??????У??????洢???棬??ò???????????
????MyISAM??MEMORY ?洢???棬???????????(table-level locking)??
????BDB ?洢??????????????(Page-level locking)??????????????
????InnoDB?洢???棬????????м???(row-level locking)???????????????
??????4????????????£????????????е?ACID????????????????????
????INNODB ?洢????????????У??????????????????????????????????????3?????????
????1.record lock :???????????
????2.Gap lock ??????????????????????
????3.Next-key lock:??????????????????
??????????У?????и??????????????????????????Χ????????????????????????????????????????