Bug 143724 - mysqld init needs to specify the mysqld.pid location on startup
Summary: mysqld init needs to specify the mysqld.pid location on startup
Alias: None
Product: Fedora
Classification: Fedora
Component: mysql (Show other bugs)
(Show other bugs)
Version: 3
Hardware: All Linux
Target Milestone: ---
Assignee: Tom Lane
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-12-25 15:32 UTC by David Golden
Modified: 2013-07-03 03:03 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-21 22:04:08 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to add pid-file argument to mysqld init script (569 bytes, patch)
2004-12-25 15:34 UTC, David Golden
no flags Details | Diff

Description David Golden 2004-12-25 15:32:23 UTC
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):


How reproducible:

Steps to Reproduce:
1.  service mysqld start
2.  ls /var/run/mysqld
Actual results:

Expected results:

Additional info:
Fixable by adding "--pid-file=/var/run/mysqld/mysqld.pid" to the call
to safe_mysqld.

Comment 1 David Golden 2004-12-25 15:34:29 UTC
Created attachment 109123 [details]
patch to add pid-file argument to mysqld init script

Comment 2 Tom Lane 2004-12-27 17:18:16 UTC
There is already an entry
in the standard /etc/my.cnf.  I don't see a need to repeat it in the
init file.

Comment 3 David Golden 2004-12-27 18:47:37 UTC
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

Comment 4 Tom Lane 2004-12-27 19:30:59 UTC
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

Comment 5 David Golden 2004-12-27 23:16:20 UTC
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
pid-file option.

Comment 6 Sander van Boxtel 2005-01-03 22:58:58 UTC
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.

Comment 7 Tom Lane 2005-01-05 19:20:38 UTC
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
RHEL4 though.

Comment 8 Tom Lane 2005-03-21 22:04:08 UTC
This is fixed in pending updates for RHEL-3 and RHEL-4.

Note You need to log in before you can comment on or make changes to this bug.