Red Hat Bugzilla – Bug 181614
mysqld startup script contains hard-coded data path
Last modified: 2013-07-02 23:08:18 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:22.214.171.124) Gecko/20060111 Firefox/126.96.36.199
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):
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.
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
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 ***