Sunday, June 12, 2016

permissions - Percona MySQL 5.5 fails to start



trying to setup new server here but keep getting this in error log:



mysqld_safe Starting mysqld daemon with databases from /data/mysql/myisam
[Warning] Can't create test file /data/mysql/myisam/hostname.lower-test
[Warning] Can't create test file /data/mysql/myisam/hostname.lower-test

[Note] Flashcache bypass: disabled
[Note] Flashcache setup error is : setmntent failed

/usr/sbin/mysqld: File '/var/mysql/bin/bin-log.index' not found (Errcode: 13)
[ERROR] Aborting

[Note] /usr/sbin/mysqld: Shutdown complete

mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended



everything under /data/mysql (it's ibdata and myisam folders) is owned my mysql:mysql and has proper permissions



same goes for folders with bin and relay logs under /var/mysql



apparmor is purged from server



any ideas?



PS




it seems like something else apart from apparmor is affecting permissions to access mysql files



after i changed data directory to more default one - /var/lib/mysql and "Can't create test file" error is gone, but "'/var/mysql/bin/bin-log.index' not found (Errcode: 13)" is still there



PPS



so i installed apparmor back and added all folders to mysqld's profile and errors mentioned above are now gone(or mysql doesn't even get to that point now)



what i have now is this: /usr/sbin/mysqld: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory




banging my head against the wall.


Answer



This question is a bit old now, but in case other people come across this page (like I did), here is what got me working:



In my case the answer was apparmor.



The solution:
edit the file /etc/apparmor.d/usr.sbin.mysqld




Add the following lines:



/path/to/new/data/ r,
/path/to/new/data/** rwk,
/path/to/new/logs/ r,
/path/to/new/logs/ rw,


Then restart apparmor:




sudo /etc/init.d/apparmor restart


AppArmor is preventing mysql from accessing the new locations for these files. This is why the permissions all look correct. It is correct that "something" is preventing mysql from accessing the new locations. That "something" is "apparmor" :-)



Apparmor seems to be standard on Ubuntu 11.10, which is where I had this problem. 10.04 does not seem to have Apparmor installed by default.



Hope this helps someone, I've been tearing my hair out over this one for too many hours!


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...