1763
MariaDBERRORNotableTransactionsHIGH confidence
Cannot execute statement in a READ ONLY transaction
Production Risk
Low — statement rejected.
What this means
A data-modifying statement (INSERT, UPDATE, DELETE, DDL) was executed inside a transaction that was explicitly started as READ ONLY.
Why it happens
- 1Transaction started with START TRANSACTION READ ONLY.
- 2Session-level transaction_read_only variable is set to ON.
How to reproduce
trigger — this will error
trigger — this will error
START TRANSACTION READ ONLY;
INSERT INTO logs (msg) VALUES ('test'); -- not allowedexpected output
ERROR 1763 (25006): Can't execute a write in a READ ONLY transaction.
Fix
Use a regular read-write transaction
Use a regular read-write transaction
START TRANSACTION; -- or START TRANSACTION READ WRITE;
INSERT INTO logs (msg) VALUES ('test');
COMMIT;Why this works
A read-write transaction allows both reads and writes.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1763 ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev