Mysql – Can’t stop thesql too many connections

MySQLshell

running

mysqladmin shotdown

gives

mysqladmin: connect to server at 'localhost' failed
error: 'Too many connections'

Can't find a solution to reboot mysql

Best Answer

Try sending killall -sigterm mysqld. Mysql should capture the signal and gracefully shut down without needing to create a connection to the server. If you are running multiple parallel instances of mysqld, and only wish to shut down one, you'll have to figure out which instance you want to kill, either by netstat -lnp and pick the listening port associated, or lsof -n and locate the database storage path for the instance you wish to stop. Then using the discovered pid, kill -sigterm <pid>