Bug 181614

Summary: mysqld startup script contains hard-coded data path
Product: Red Hat Enterprise Linux 3 Reporter: Gavin Edwards <gavin.s.edwards>
Component: mysqlAssignee: Tom Lane <tgl>
Status: CLOSED DUPLICATE QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: medium    
Version: 3.0CC: byte, hhorak
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-15 15:28:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gavin Edwards 2006-02-15 14:23:52 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

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):
mysql-server-3.23.58-16.RHEL3.1

How reproducible:
Always

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.

i.e.
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 15:28:00 UTC
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 ***