命令行验证MySQL的隔离级别
#JDBC 命令行验证MySQL的隔离级别 root

CREATE USER tom IDENTIFIED BY '123456';

SHOW DATABASES;

GRANT SELECT,INSERT,UPDATE,DELETE ON test.* TO tom@'%';

USE test;

SELECT * FROM user_table WHERE user = 'CC';

SET AUTOCOMMIT = FALSE;

SELECT @@transaction_isolation;

#REPEATABLE-READ
SELECT * FROM user_table WHERE user = 'CC'; #2000

SELECT * FROM user_table WHERE user = 'CC'; #2000

SELECT * FROM user_table WHERE user = 'CC'; #2000

COMMIT;

SELECT * FROM user_table WHERE user = 'CC'; #3000


SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;

SELECT @@transaction_isolation;

SET AUTOCOMMIT = FALSE;

USE test;

#READ-COMMITTED
SELECT * FROM user_table WHERE user = 'CC'; #3000

SELECT * FROM user_table WHERE user = 'CC'; #3000

SELECT * FROM user_table WHERE user = 'CC'; #4000

COMMIT;


SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @@transaction_isolation;

SET AUTOCOMMIT = FALSE;

#READ-UNCOMMITTED
SELECT * FROM user_table WHERE user = 'CC'; #4000

SELECT * FROM user_table WHERE user = 'CC'; #5000

SELECT * FROM user_table WHERE user = 'CC'; #4000
#JDBC 命令行验证MySQL的隔离级别 tom

SHOW DATABASES;

SHOW DATABASES;

USE test;

SELECT * FROM user_table WHERE user = 'CC';

SET AUTOCOMMIT = FALSE;

SELECT @@transaction_isolation;

#REPEATABLE-READ
SELECT * FROM user_table WHERE user = 'CC'; #2000

UPDATE user_table SET balance = 3000 WHERE user = 'CC';

SELECT * FROM user_table WHERE user = 'CC'; #3000

COMMIT;


SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;

SELECT @@transaction_isolation;

SET AUTOCOMMIT = FALSE;

USE test;

#READ-COMMITTED
SELECT * FROM user_table WHERE user = 'CC'; #3000

UPDATE user_table SET balance = 4000 WHERE user = 'CC';

COMMIT;


SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @@transaction_isolation;

SET AUTOCOMMIT = FALSE;

#READ-UNCOMMITTED
SELECT * FROM user_table WHERE user = 'CC'; #4000

UPDATE user_table SET balance = 5000 WHERE user = 'CC';

ROLLBACK;

SELECT * FROM user_table WHERE user = 'CC'; #4000
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇