Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question
This is off-topic for StackOverflow. Voting to move to dba.se –  Kermit Mar 16 '13 at 15:40
add comment

migrated from stackoverflow.com Mar 17 '13 at 11:44

This question came from our site for professional and enthusiast programmers.

2 Answers

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'
share|improve this answer
The problem is that SSH cannot complete a login because of the lack of resources. Even though you are doing it all on the command line, internally SSH still must log in, get a process, etc. That times out because of MySQL. (The error message after a couple of minutes is "Connection reset by Peer". Mysql is still running that is why I was wondering if I could send it a commit suicide command. –  mlewis54 Mar 16 '13 at 15:49
@mlewis54 you can't connect to mysql remotely at all? –  Explosion Pills Mar 16 '13 at 15:52
I can actually connect to the server using mysql -h IPADDR. But mysqladmin -h IPADDR just outputs the usage listing. It doesn't recognize the -h (or --host=IPADDR) command. –  mlewis54 Mar 16 '13 at 16:01
mysqladmin -h IPADDR just outputs the usage listing, yes, but not because it doesn't recognize --host. The problem is, mysqladmin requires an actual command to be specified such as shutdown or status -- you can't just type "mysqladmin" (with or without options) and omit the actual thing you want mysqladmin to do. –  Michael - sqlbot Mar 18 '13 at 18:52
add comment

This should work.

mysqladmin shutdown

More at Here

share|improve this answer
it would work if I could log into the box. –  mlewis54 Mar 16 '13 at 15:50
oh yeah,my bad.You can connect using MySQL bench ? if so,you can stop the server for there. '-h' should work! well you are sure you have the remote access right? –  Yash Mar 16 '13 at 16:11
see my last comment on the answer above. Mysqladmin -h is ignoring the command. I can connect using mysql bench, but remote access is SSH based and SSH can't connect. We're talking rock and hard place here. –  mlewis54 Mar 16 '13 at 16:15
SSH can't connect .hmm, Sorry dude seems like major prob then I thought ! Lets hope some one solves this :) Good luck! –  Yash Mar 16 '13 at 16:28
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.