Giter Club home page Giter Club logo

mysql_doc's People

Watchers

 avatar

mysql_doc's Issues

mysql_kill_process

最后,附上一个快速 kill 掉 MySQL 会话的方法:

首先使用如下语句分析出有问题的 SQL:

/usr/local/mysql/bin/mysql -uroot -p'XXX'
-e "SHOW FULL PROCESSLIST;" | more
然后将 SHOW FULL PROCESSLIST 的结果保存到一个文件:

/usr/local/mysql/bin/mysql -uroot -p'XXX'
-e "SHOW FULL PROCESSLIST;" |
grep "XXX" | awk '{print $1}' > mysql_slow.txt
最后使用如下简单的 Shell 脚本 kill 掉相关会话:

for i in cat mysql_slow.txt
do
/usr/local/mysql/bin/mysql -uroot -p'XXX' -e "kill $i"
done
当然也可以使用如下 SQL 拼接 kill 语句:

SELECT concat('kill ',id,';')
FROM information_schema.processlist
WHERE info LIKE 'XXX';
Enjoy!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.