This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 143724 - mysqld init needs to specify the mysqld.pid location on startup
mysqld init needs to specify the mysqld.pid location on startup
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: mysql (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-25 10:32 EST by David Golden
Modified: 2013-07-02 23:03 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-21 17:04:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description David Golden 2004-12-25 10:32:23 EST
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):

mysqld-server-3.23.58-13

How reproducible:
Very

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

Expected results:
mysqld.pid

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 10:34:29 EST
Created attachment 109123 [details]
patch to add pid-file argument to mysqld init script
Comment 2 Tom Lane 2004-12-27 12:18:16 EST
There is already an entry
pid-file=/var/run/mysqld/mysqld.pid
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 13:47:37 EST
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
user-friendly.
Comment 4 Tom Lane 2004-12-27 14:30:59 EST
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
trouble.
Comment 5 David Golden 2004-12-27 18:16:20 EST
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 17:58:58 EST
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
time.

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 14:20:38 EST
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 17:04:08 EST
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.