InnoDB: Operating system error number 13

I was looking tonight on having the datadir for MySQL changed from /var to /home (as the /var partition was almost full). Once this has been done, I noticed that MySQL was no longer starting and it’s log was returning the following error:

Jan 28 22:18:35 mysqld[24760]: 101011 22:18:35  InnoDB: Operating system error number 13 in a file operation.
Jan 28 22:18:35 mysqld[24760]: InnoDB: The error means mysqld does not have the access rights to
Jan 28 22:18:35 mysqld[24760]: InnoDB: the directory.
Jan 28 22:18:35 mysqld[24760]: InnoDB: File name ./ibdata1
Jan 28 22:18:35 mysqld[24760]: InnoDB: File operation call: ‘create’.
Jan 28 22:18:35 mysqld[24760]: InnoDB: Cannot continue operation.

After a long investigation I noticed that this was the direct result of having SeLinux enabled on the server:

root@dragos [~]# sestatus
SELinux status:                 enabled

As my customer was running CentOS on the machine, I went ahead and had SeLinux disabled, by running:

root@root [~]# setenforce 0
setenforce: SELinux is disabled

The above method would allow you to disable SeLinux without having to reboot the machine. Having SeLinix disabled by editing /etc/selinux/config would require a server reboot.

3 thoughts on “InnoDB: Operating system error number 13

Leave a Reply

Your email address will not be published. Required fields are marked *