Server shutdown from power failure.
Mysql will not start now.
Disk is not full.
Syslog is below
Oct 11 15:03:31 joe mysqld_safe[24757]: started
Oct 11 15:03:31 joe mysqld[24760]: 101011 15:03:31 InnoDB: Operating system error number 13 in a file operation.
Oct 11 15:03:31 joe mysqld[24760]: InnoDB: The error means mysqld does not have the access rights to
Oct 11 15:03:31 joe mysqld[24760]: InnoDB: the directory.
Oct 11 15:03:31 joe mysqld[24760]: InnoDB: File name ./ibdata1
Oct 11 15:03:31 joe mysqld[24760]: InnoDB: File operation call: 'create'.
Oct 11 15:03:31 joe mysqld[24760]: InnoDB: Cannot continue operation.
If you use SEL Linux
Intall semanage
yum whatprovides /usr/sbin/semanage
you getpolicycoreutils-python-2.5-22.el7.x86_64
See mysqld security context
After installation
yum install policycoreutils-python
you can just look what different security context mysqld has.Here you see all context for mysqld a short list with explanation
So if you have the wrong security context on your files you get a permission denied (error 13)
Solution
But check the "normal" permissions, too. I had this problem with
centos
. You have tosystemctl restart mysql
for the changes.When this popped up for me, I found the answer in the
/etc/mysql/my.cnf
configuration file. Thedatadir
line did not point to the/var/lib/mysql
directory (where the databases are). Once I put this path in, the server restarted no problem.If you are using ubuntu or apparmor you should permit this change in apparmor.
Edit
/etc/apparmor.d/usr.sbin.mysqld
and change/var/lib/mysql
with the newDATADIR
.It should work.
In short, (especially on RHEL/CentOS/Fedora) try
if it replies with
Enforcing
you have SELinux up and running. Temporarily deactivate it withsetenforce 0
and see if MariaDB starts now! Rather common, especially on RHEL/CentOS/Fedora.There's more about this further down, as well as in this official article.
In general
There are more things in a UNIX environment that might prevent file access, than just user access rights.
Additionally there could be other unexpected factors, like ...
datadir
being set to a place, where mysql doesn't have permissions (see/etc/my.cnf
)Just to mention a view things off the top of my head (feel free to edit/add to this answer btw).
In the case, SELinux is "the problem"
For a permanent solution, you could try to restore the appropriate security context, ...
... or just deactivate SELinux (but think about this one a little bit before doing so), by editing the config (typically in
/etc/selinux/config
) and settingSELINUX=disabled
as suggested in following article.Obviously those are applicable to MySQL just the same way.
I had the same problem. Did alot of research and found out this solution. You need to run this command on ibdata1 sudo shadowprotect -u root | root
I dont know what this does.. but it worked for me.
Good luck.
The file is not corrupt. You can find out the source of these errors with 'perror'. i.e.
InnoDB has corruption detection (page checksums) and would happily tell you if that were the problem.
Either the directory permissions have changed, or your my.cnf file has been hosed, and it's trying to recreate data files somewhere else.