先创建一张名为test_innodb_lock的表,其结构和数据如下所示:
DROP TABLE IF EXISTS test_innodb_lock;
CREATE TABLE test_innodb_lock(
a INT(11),
b VARCHAR(20)
)ENGINE INNODB DEFAULT CHARSET=utf8;
INSERT INTO test_innodb_lock VALUE(1,'a');
INSERT INTO test_innodb_lock VALUE(2,'b');
INSERT INTO test_innodb_lock VALUE(3,'c');
INSERT INTO test_innodb_lock VALUE(4,'d');
INSERT INTO test_innodb_lock VALUE(5,'e');
接着再创建两个索引:
CREATE INDEX idx_lock_a ON test_innodb_lock(a);
CREATE INDEX idx_lock_b ON test_innodb_lock(b);
查看MySQL数据库是否自动提交事务的SQL命令:
SHOW VARIABLES LIKE 'autocommit';
|