0

I have two questions about MySQL usage:

I installed mysql5.7 by default options. then I connect to MySQL by MySQL query browser:

1) if I run "SET autocommit='OFF'", then I use "show variables like 'autocommit';" to check the value, but I still get the result: autocommit='ON'.

Only if I run "SET global autocommit='OFF';" then I can see the value has been changed, why?

2) with autocommit='ON' , I want to lock a table by:

lock tables xxx write

but I can still query this table from another session.

why?

  • Pls do not ask multiple questions in a single post. – Shadow Apr 18 '19 at 10:55
  • If the scenario in the 2nd question were true, then you found a bug in MySQL. My suspicion is that you do not do everything by the book, hence the behaviour. An this has nothing to do with auto commit. Lock tables statement is a non-transactional statement, it commits any open transaction. – Shadow Apr 18 '19 at 11:08
  • I found it's the client issue - MySQL query browser. If I change to use MySQL.exe, the issue disappears – winnie_quest Apr 23 '19 at 01:03

0 Answers0