Someone asked me today why their MySQL databases seem to be getting corrupted when they used a custom init script they hacked up to stop it. Well, when I took a look it appeared that they someow got the idea that sending SIGKILL to stop every PID with ‘mysql’ in the name was a good idea.
This is a really bad idea for a couple of reasons. First off, picking which processes to slay based on the name is a horrible idea because there could certainly be other processes with mysql in the name which should be kept running in some instances. And secondly, stopping MySQL with a SIGKILL will _corrupt_ databases. It’s completely untrappable by any process, and affords it no chance whatsoever to clean itself up and die gracefully.
In my opinion, a SIGKILL should only be used as a last resort, and one should at least give a SIGHUP and a SIGINT first to try and do things properly.