Mysql – Remotely shutdown a MySQL server

MySQL

I have MySQL 5.0.27 running on a Linux server. It is consuming too many resources (it is running about 80 tasks loading a database). I am unable to log into the server to reduce the number of tasks because SSH, while accepting a password, will time out while requesting a new channel because of the system load.

Can I remotely send a shutdown command to the server? It is possible from another server to either use mysql or mysqladmin with a -h option or use MySQL workbench to shut the server down gracefully?

If I reboot the server I will need to repair two large tables (>200m records) which takes hours. I'd like to avoid this option.

Best Answer

You can send commands via ssh (that is you don't have to actually log in and run the command):

ssh user@host 'mysqladmin shutdown'