Red Hat Bugzilla – Bug 143724
mysqld init needs to specify the mysqld.pid location on startup
Last modified: 2013-07-02 23:03:06 EDT
Description of problem:
The /etc/init.d/mysqld script "start" function needs to specify a
mysqld.pid location to safe_mysqld so that it matches the mysqld.pid
location checked later by "stop".
The symptom of the problem is that "service mysqld stop" fails and the
mysqld server is not stopped -- tracing this reveals that safe_mysqld
doesn't write the PID where the stop function expects it.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. service mysqld start
2. ls /var/run/mysqld
Fixable by adding "--pid-file=/var/run/mysqld/mysqld.pid" to the call
Created attachment 109123 [details]
patch to add pid-file argument to mysqld init script
There is already an entry
in the standard /etc/my.cnf. I don't see a need to repeat it in the
Hmm. That explains it. I had a my.cnf file that was working
perfectly well when I upgraded and didn't realize that line needed to
be added. I checked the /etc/sysconfig/mysqld and didn't see it. I
also didn't see a "pid-file" line when I checked the sample
configuration files in /usr/share/docs/mysql-server-3.23.58/. Nor was
there a README.REDHAT file.
If you don't want to move the pid-file setting from the my.cnf file to
the init file or sysconfig file, could I suggest at least adding a
README.REDHAT file to the docs directory to alert sysadmins that this
line is necessary to work with the Redhat/Fedora init file, as is
differs from the mysql defaults? Alternatively, a one-line comment in
the init file that the pid is set in my.cnf (as opposed to
/etc/sysconfig/mysqld or anywhere else) would be helpful and
Er ... upgraded from what exactly? I haven't been maintaining Red
Hat's mysql RPMs for very long, but AFAICT from our CVS we have always
had the pid-file line in there.
The Red Hat build differs from MySQL AB's out-of-the-box configuration
in several ways (different directory paths mostly) so I'm not sure
that it should be expected to overwrite a raw MySQL build without
The upgrade was to FC3 from FC2, but that was an upgrade from FC1, RH8
(I think), etc. It's hard to say where the config file changed on my
end -- somewhere along the line I probably took the example files from
/usr/share/docs/mysql-server-xx.xx.xx/ and customized it, and never
noticed the pid issue until now. During upgrades there are a ton of
.rpmsave and .rpmnew files that get created, diffing them all takes a
lot of time and I may have just missed it. My broader point was that
anywhere that a RedHat build differs substantially, having a
README.REDHAT with the differences or at least a comment in the init
script is a very user-friendly way of communicating the differences.
The init script depends on the pid file being in a certain location,
so my personal feeling is that that's the place (or the corresponding
/etc/sysconfig/mysqld file) to put something like that. If you want
to keep it in the my.cnf file, that's functionally the same, but I
think it would make sense to note that fact in the init script in case
anyone ever replaces the default my.cnf with something (like from the
docs directory or of their own invention) that doesn't include the
Nice to read that there is already an entry for this 'problem'.
I registered an account on Bugzilla especially for this issue. It took
me 2,5 hours to find out why my 'service mysqld stop' [FAILED] all the
The reason was that i replaced '/etc/my.cnf' with
'/usr/share/doc/mysql-server-3.23.58/my-medium.cnf', hoping that would
better suit my situation. And in that file the location for the .pid
file was not defined. So mysql placed it in the /var/lib.
I hope (for other people who will encounter this problem) that it will
be changed to something more flexible.
Given that MySQL AB supplies sample config files that don't contain
any pid-file entry, I suppose you're right that we'd best not assume
there is one in the file. I've added a --pid-file switch to the init
script in mysql-3.23.58-14 for FC3. This is still an open issue for
This is fixed in pending updates for RHEL-3 and RHEL-4.