Skip to content

Instantly share code, notes, and snippets.

@nikhilw
Last active March 3, 2017 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhilw/2a64c1d1d7b6952b7b8cac0f6ed67df2 to your computer and use it in GitHub Desktop.
Save nikhilw/2a64c1d1d7b6952b7b8cac0f6ed67df2 to your computer and use it in GitHub Desktop.
Kill all open connections to a mysql server
#! /bin/bash
mysql -u root -proot -e "select id from information_schema.processlist;" | grep -e [0-9] | while read in; do mysql -u root -proot -e "kill $in"; done
echo "verify"
mysql -u root -proot -e "select count(id )from information_schema.processlist;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment