From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020918 Description of problem: If you move the mysql data dir in /etc/my.cnf, the server no longer starts. Version-Release number of selected component (if applicable): 3.23.49-3 How reproducible: Always Steps to Reproduce: 1. add datadir=/mnt/disk1/mysql/data to the mysqld section of /etc/my.cnf 2. move /var/lib/mysql to /mnt/disk1/mysql/data 3. /sbin/service mysqld start Actual Results: The server does not start. Warning messages about missing /var/lib/mysql are emitted Expected Results: Server should find the changed data directory and start normally Additional info: There is a hardcoded "/var/lib/mysql" in the startup script. Replace this with datadir=`grep -i ^datadir /etc/my.cnf | sed 's/^datadir=//ig'`
It's working as designed. my.cnf should define exactly were things are. It's like moving executable X out of your PATH definition and wondering why the OS does find it. Closing as not-a-bug.
Did you actually _read_ what I wrote? I did write "add datadir=/mnt/disk1/mysql/data to the mysqld section of /etc/my.cnf" So my.cnf _does_ reflect the current configuration on my system. Just the startup script (which is red hat provided) isn't able to cope with the situation. I need 'a little more' disk space for my databases than available on the /var drive and I neither want to do a sub mount nor a symlink (which costs at every file lookup). All I need is a startup script, that is not brain damaged. I even sent you a patch. The problem is not the moved data directory. mysql runs fine with the moved data directory. It even keeps its socket in /var/lib/mysql. The problem is the startup script. Did you actually try out what I told you? (Almost five month of inactivity from RedHat and then "we don't care". Your support is really lacking these days.)
Yes, you've changed it in one spot, my.cnf, but not the other. It was worded a little awkward in my prior reply. Yes, your script resets the datadir in the mysqld init script and yes, I tried using it. If you hardcode the new datadir in the mysqld startup script, does it work? Of course it does. The startup script and my.cnf are provided as default scripts / configuation files. Change as required. I'll leave it open as an enhancment request and we'll revisit it once the current backlog is removed. As for the time delay, we're sorry about that. Trond (the previous owner) no longer works for the company and we're in the process of clearing the backlog. As for the "we don't care"... we do care. Sometimes a bug is closed without the resolution that you'd like. We can't put in everything suggested and have to make judgement calls.
The /etc/rc.d/init.d/mysqld isn't marked as a configuration file in your RPM (or it would have the %config identifier). Using a startup script and having to configure a crucial parameter like the data directory in two different places (where one is non-obvious), isn't a good solution.
*** Bug 82152 has been marked as a duplicate of this bug. ***
*** Bug 88117 has been marked as a duplicate of this bug. ***
Hello to all, I have recently run into the same problem as described in innitial post. It took me few HOURS until I have discovered that init.d/mysqld is broken. Then I have found this almost 1 year old bugzilla record. Please, why is it such a big problem to correct datadir in /etc/init.d/mysqld and as a result to fix this annoying bug? Simply replace datadir=/var/lib/mysql with datadir=`grep -i ^datadir /etc/my.cnf | sed 's/^datadir=//ig'` I suppose /etc/my.cnf is considered as a regular CONFIGURATION file which can be freely changed at any time. But when I do this, MySQL init scripts stop working. This I really consider as a bug, not an _enhancement_. Can I hope that this will be fixed in next MySQL RPM-package update? Thanks && best regards, Robert Nedbal
*** Bug 110657 has been marked as a duplicate of this bug. ***
It looks to me like most of the entries in /etc/my.cnf are effectively hard-coded in the init script: I see references to the socket, the err-log, and the pid-file as well as the datadir. If we're gonna do anything about this we'd really need to fix them all. The proposed "grep" solution is simple but I think it is too fragile. What happens if there are multiple lines in different sections that match the grep pattern --- which one is right, and how would we get the script to pick it? Also, does the MySQL code allow comments on the same line as a variable setting, and if so what do they look like?
I've finally taken the time to fix the init script as of mysql 4.1.7-8. It will now honor settings in /etc/my.cnf for the aforementioned values.
*** Bug 146867 has been marked as a duplicate of this bug. ***
Just discovered this bug, and despite Tom Lane'd comment the issue still exists in latest FC3. Along with the others, I regard the issue as a bug in the init script.
*** Bug 181614 has been marked as a duplicate of this bug. ***