版权声明:本文为博主原创文章,转载请注明出处 https://blog.csdn.net/vkingnew/article/details/86516003
--报错信息:
2019-01-16T13:37:20.263893Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2019-01-16T13:37:20.264159Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2019-01-16T13:37:20.264300Z 0 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions
2019-01-16T13:37:20.264325Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-01-16T13:37:20.868581Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-01-16T13:37:20.868771Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-01-16T13:37:20.869035Z 0 [ERROR] Failed to initialize builtin plugins.
2019-01-16T13:37:20.869081Z 0 [ERROR] Aborting
--解决方法:
由于使用的rpm直接安装,修改了datadir的数据存储路径
[root@oracle mysql]# chown -R mysql:mysql /data/mysql
[root@oracle mysql]# chmod -R 775 /data/mysql/
无论怎么重试都报错。
突然想到是不是可能和SELinux有关,SELinux默认是开启的。
# /usr/sbin/sestatus -v
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
...
# getenforce
Enforcing
# ls -Z /data/mysql/
-rwxrwxr-x. mysql mysql system_u:object_r:default_t:s0 auto.cnf
-rwxrwxr-x. mysql mysql system_u:object_r:default_t:s0 ca-key.pem
-rwxrwxr-x. mysql mysql system_u:object_r:default_t:s0 ca.pem
# vim /etc/sysconfig/selinux
SELINUX=disabled
重启操作系统,重试。
果然这个报错和SELinux有关,SELinux在实际使用的时候还是关闭为好,可以避免不少问题。