MySQL 死锁导致无法查询解决
来源:互联网 发布:199it大数据工具导航 编辑:程序博客网 时间:2024/06/05 23:37
最近在维护数据库时,解析数据时候,数据一直不能入库。原因知道,是因为MySQL的事务产生了死锁,前几次我直接重启MySQL.
最近发现频繁的出现。所以找到一种方法。
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id
trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs
trx_lock_memory_bytes
trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks
trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched
trx_adaptive_hash_timeouttrx_id
trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query
trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes
trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks
trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched trx_adaptive_hash_timeout
查看事件比较久的事物。如何当前时间select sysdate();AM 10:07而事物开始的时间是:AM 9:50,显示是不正常的。根据这个事物的线程ID(trx_mysql_thread_id)。
执行命令:
kill 线程ID
数据库修复正常。
查看正在锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
查看等待锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
最近发现频繁的出现。所以找到一种方法。
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id
trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs
trx_lock_memory_bytes
trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks
trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched
trx_adaptive_hash_timeouttrx_id
trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query
trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes
trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks
trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched trx_adaptive_hash_timeout
查看事件比较久的事物。如何当前时间select sysdate();AM 10:07而事物开始的时间是:AM 9:50,显示是不正常的。根据这个事物的线程ID(trx_mysql_thread_id)。
执行命令:
kill 线程ID
数据库修复正常。
查看正在锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
查看等待锁的事务
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
0 0
- MySQL 死锁导致无法查询解决
- MySQL死锁导致无法查询
- MySQL死锁导致无法查询
- MySQL死锁导致无法查询
- MySQL死锁导致无法查询
- MySQL死锁导致无法查询
- 查询死锁 和 解决死锁
- 磁盘满导致mysql死锁
- MYSQL外键导致死锁
- MySQL-死锁查询
- MySQL-死锁查询
- mysql 查询表死锁
- MySQL-死锁查询
- MySQL死锁解决原则
- Mysql Innodb死锁解决
- Mysql查询语句使用select.. for update导致的数据库死锁分析
- java代码死锁导致事务无法提交
- mysql查询表死锁和结束死锁
- innodb_lock_wait_timeout
- fedora14-yum源的配置使用详解-zz150122
- MySQL 事务没有提交导致 锁等待 Lock wait timeout exceeded
- MDS图示聚类结果
- mac下android studio打不开sdk manage
- MySQL 死锁导致无法查询解决
- 1205 Lock wait timeout exceeded try restarting transaction
- 启动innodb_monitor的方法
- 怎么看mysql有没阻塞
- Include EPS files in LaTeX
- chm
- iOS 两个视频首尾合并- AVAssetExportSession
- MySQL死锁导致无法查询
- Linux下 编译C++