rishel.org

8/7/2007

mysqld failing to load after changing default locations

I just solved a problem at work that google was no help with. I'm posting this in hopes some other poor soul who has the same problem finds this post. After an OS re-install (Red Hat Enterprise Linux AS 4) we were changing the default location of data used for application into a different filesystem mounted to /obscure/location/work/uses/ in that directory, each application has it's own folder, and then automounts to /apps/appname. We setup /apps/mysql and edited /etc/my.cnf to point everything but /var/run/mysqld/mysqld.pid to this new location. Makes sense, right? But now, mysql won't start. statur reports:
#service mysqld status
mysqld dead but subsys locked

in course of investigation, I check /var/log/messages and see something like:

Jan 6 01:23:27 localhost kernel: audit(1105003407.183:0): avc: denied { append } for pid=12380 exe=/usr/sbin/mysqld path=/var/lib/mysql/localhost.localdomain.err dev=sda1 ino=3450322 scontext=root:system_r:mysqld_t tcontext=root:object_r:var_lib_t tclass=file

this error message will lead you down a trail of dispair. If you're having the same problem I did, ignore this error message.

The reason the startup scripts are failing is that something is hardcoded to look for the mysql files in /var/lib/mysql. A symlink to /apps/mysql:

ln -s /apps/mysql/ /var/lib/

and mysql starts up without problem.

Now, if someone could explain why mysql client or startup scripts fails to read /etc/my.cnf correctly, I'd love to hear it.

Filed under: Linux — Jay @ 1:00 pm

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress