Bug 181614 - mysqld startup script contains hard-coded data path
mysqld startup script contains hard-coded data path
Status: CLOSED DUPLICATE of bug 76051
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: mysql (Show other bugs)
x86_64 Linux
medium Severity low
: ---
: ---
Assigned To: Tom Lane
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2006-02-15 09:23 EST by Gavin Edwards
Modified: 2013-07-02 23:08 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-02-15 10:28:00 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Gavin Edwards 2006-02-15 09:23:52 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060111 Firefox/

Description of problem:
The /etc/rc.d/init.d/mysqld startup script contains a data path hard-coded into the script. This means that if you change mysqld's data directory in /etc/my.cnf you also have to manually edit the startup script.

This can't be intentional as it's trivial to include a statement to extract the path from /etc/my.cnf and under normal circumstances one wouldn't be expected to manually edit startup scripts.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Change datadir variable in /etc/my.cnf
2. Attempt to start mysqld for the first time when databases are to be initialised.
3. Watch it fail.

Actual Results:  In my particular case I moved the mysqld data path in /etc/my.cnf to /home/mysql and then put a softlink from the original path to the new path.

cd /var/liv
mv mysql mysql.ORIG
ln -s /home/mysql mysql

During the database initialisation phase of the startup script it puts the initial databases in owned as root and then chowns the files. However, it performs a chown command "chown -R mysql:mysqm /var/lib/mysql" This only chown's the softlink and not the directory it points to and files therein.

So there seemed to be two solutions.
1) Change the datadir path in /etc/my.cnf to the new location
2) Manually edit the startup script to include a trailing slash in the chown command.

As it turns out, you have to edit the startup script either way thanks to the hard-coded data path.

Expected Results:  I would expect the startup script to enquire where the data path is configured in /etc/my.cnf

Additional info:
Comment 1 Tom Lane 2006-02-15 10:28:00 EST
That is how it works as of RHEL4.  I am disinclined to change the behavior of
the script in RHEL3, though, since it seems at least as likely to break existing
installations as do anything very helpful for them :-(

*** This bug has been marked as a duplicate of 76051 ***

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