Home > Database > Mysql Tutorial > body text

让我们远离Mysql死锁_MySQL

WBOY
Release: 2016-06-01 13:07:19
Original
964 people have browsed it

使用Mysql进行Web项目开发的童鞋们估计都碰到过死锁的问题,这个问题也一直困扰着我们团队,经常都不知道原因系统就无法使用,罪魁祸首就是死锁,今天我们就来干掉它,从此让我们不再为死锁而苦恼。

登录Mysql,来到命令模式下,使用命令:show engine innodb status  看看innodb引擎的状态,可以知道引起死锁的SQL语句是什么?分析下索引的情况,进行SQL优化。

然后我们可以看一下死锁的进程:

show processlist;

找出产生死锁进程的ID,然后Kill掉。

kill processid;

另外,我们也可以开启慢查询,观察下我们的库中到底有没有慢查询产生。

这样可以为我们解决掉死锁问题,是不是很简单啊,哈哈。

 

 

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!