mysql查看被锁住的表
show OPEN TABLES where In_use > 0;
MySQL:
show processlist;
mariabd:
show full processlist;
查询到相对应的进程===然后 kill id
kill $pid
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
show engine innodb status\G;
查看造成死锁的sql语句,分析索引情况,然后优化sql语句;
show status like '%lock%';
show variables like '%timeout%';