1

I'm trying to convert a database from MsSQL to MySQL.

How exactly should the transaction configuration be done in MySQL for the Serializable isolation level that exists in MsSQL? Because MsSQL keyword didn't work.

Example;

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION;
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition GO
COMMIT TRANSACTION;
GO

Except this; Is there a row-based locking feature when transacting on a row of the table between transaction begin and commit?

Example;

UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition

// row-based locking for only condition

If it is disabled by default, what should I do to enable it?

Thank you.

  • first, these two sql is transact sql but they differentiated at much point. could you share DDL to determine where is the problem. You should give some details about the versions too. and you can check how does it work of mysql's transaction. https://dev.mysql.com/doc/refman/8.0/en/sql-transactional-statements.html – Bart Jan 15 '22 at 23:19
  • I am researching the exact equivalent of the SET TRANSACTION ISOLATION LEVEL **SERIALIZABLE** statement in MSSQL for MySQL. – Pınar Seçkin Jan 15 '22 at 23:37

1 Answers1

1

did you start a transaction after set isolation level? it will set transaction level only for the next transaction. you could set it for all session via "SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;". if you want to do it during create connection to the database server you can add "?sessionVariables=transaction_isolation='SERIALIZABLE'" at the end of the connection string. or you can execute once "SET SESSION TRA...SERIALIZABLE" as soon as you connect.

Bart
  • 124
  • 7