Error
Error Code:
1223
MySQL Error 1223: Query Blocked by Read Lock
Description
This error occurs when a MySQL query cannot be executed because the current session holds a read lock on the affected resource, which conflicts with the intended operation. It typically arises when attempting to modify data (e.g., UPDATE, DELETE, INSERT) while an active shared read lock prevents exclusive write access.
Error Message
Can't execute the query because you have a conflicting read lock
Known Causes
3 known causesExplicit Table Read Lock 🔒
The current session has explicitly locked tables for read operations using `LOCK TABLES ... READ`, which prevents any subsequent write operations on those tables until the lock is released.
Global Read Lock Active 🌐
The current session has issued `FLUSH TABLES WITH READ LOCK`, putting the entire server into a global read-only state and preventing writes until the lock is released.
Application Logic Flaw 💻
The client application's code explicitly acquires a read lock on tables and subsequently attempts to execute a write query without first releasing the lock.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service