Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/ 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?


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


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: cannot open shared object file: No such file or directory

banging my head against the wall.

share|improve this question
I just want to confirm the permisison ls -l /var/mysql/bin? – quanta Aug 8 '11 at 16:40
it's empty folder rwxr-x--- mysql:mysql – keymone Aug 8 '11 at 17:57
Is mysqld actually running as the mysql user? – Shane Madden Aug 8 '11 at 18:01
well i tend to think so because that's the user in my.cnf – keymone Aug 8 '11 at 18:25
Here's a shot in the dark - did you download the right architecture (32/64bit)? I've had 'file not found' errors before due to downloading the wrong installation. – sreimer Aug 9 '11 at 21:29
up vote 4 down vote accepted

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!

share|improve this answer

If this is a brand new install, you need to run the mysql_install_db script to create the needed tables/files.

share|improve this answer
i tried - it gives me same error – keymone Aug 8 '11 at 17:57

Is it a fresh install?

bin-log.index is an index file for binary log file names. As a temporary workaround, you can comment the log-bin= line in my.cnf and try again.

If it doesn't help, try to start MySQL with mysqld_safe --user=root &, login to MySQL and run the following commands:

mysql> FLUSH LOGS;

And start MySQL again:

sudo killall mysqld_safe
sudo /etc/init.d/mysqld start
share|improve this answer
problem is that something prevents mysql process from accessing those files. i will update my question again as i found some more details – keymone Aug 9 '11 at 8:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.