kill mysqld :)

Shay Harding mekla at
Mon Apr 10 18:03:07 CDT 2000

>Hello everyone:
>Just had to restart our MySQL, it "froze". I'm working on a
>Perl-Restart-Stuff script... meaning trying to execute commands from a
>browser. So in case I'm away from my computer I can get to a browser and
>just "click here to restart" MySQL. Or "click here to restart Apache"... Or,
>to avoid logging in the machine every time something goes wrong, I can just
>point-n-click my way to a new restart...Or I can direct someone at our home
>office how to restart, etc...
>However, I have a couple of questions, they're Linux related...
>#1: I killed MySQL by executing distinct commands:
>kill -KILL 7036
>kill -KILL 7044
>kill -KILL 7045
>What I was wondering is: can I issue one command to bring all mysql
>processes to a stop.
>For example: kill -KILL 9 mysqld
>Or something like that?

Use mysqladmin. It comes with MySQL distribution. Can do 'mysqladmin shutdown'
to stop database, then issue 'safe_mysqld &' to restart database. These are
located in '/usr/local/bin' by default unless you used --prefix=/dir/ when
installing MySQL.

The 'safe_mysqld' is nothing but a shell script that does some checking and
starts the database with default options. You can set the options in it from a
text editor, but I wouldn't mess with it unless you know what you are doing
since you could break it.

>Question #2: How could I feed a "command" from a browser to a remote
>Meaning, even type it before hand, then by pressing a button I execute a
>command, as if I was logged in on the command line...

Write a script to do whatever you want and use Net::Telnet to log into the
machine and run your script, or just run the commands individually.

Hell with Net::Telnet you can even log in and 'su' to root

>Any help would be appreciated...I'll submit for posting online to our
> site in case anyone finds it helpful...



More information about the Phoenix-pm mailing list