MySQL deadlock causes query resolution bitsCN.com
MySQL deadlock causes query resolution failure
During database maintenance recently, data cannot be stored into the database during data parsing. The reason is that MySQL transactions have deadlocked. I restarted MySQL several times before.
Recent frequent occurrences. So find a method.
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
Trx_id trx_state trx_started too many trx_weight too trx_query trx_operation_state too many trx_state trx_started too many trx_weight too trx_query too many trx_last_foreign_key_error trx_adaptive_hash_latched trx_adaptive_hash_timeout
View events that take a long time. Select sysdate (); AM and the start time of the transaction is AM. the display is abnormal. The thread ID (trx_mysql_thread_id) of the transaction ).
Run the following command:
Kill thread ID
The database is restored normally.
View locked transactions
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
View the transaction waiting for the lock
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
BitsCN.com