问题描述
修改datadir目录后,启动mysql的时候报错。
[root@fazhanguo-01 resource]# service mysqld start
/sbin/restorecon: Warning no default label for /mnt/resource/mysql
Initializing MySQL database: Installing MySQL system tables...
190314 6:11:57 [Warning] Can't create test file /mnt/resource/mysql/fazhanguo-01.lower-test
190314 6:11:57 [Warning] Can't create test file /mnt/resource/mysql/fazhanguo-01.lower-test
/usr/libexec/mysqld: Can't change dir to '/mnt/resource/mysql/' (Errcode: 13)
190314 6:11:57 [ERROR] Aborting
190314 6:11:57 [Note] /usr/libexec/mysqld: Shutdown complete
Installation of system tables failed! Examine the logs in
/mnt/resource/mysql for more information.
问题分析
排查完目录权限的问题后,应该是selinux的问题
[root@fazhanguo-01 resource]# service mysqld start
Enforcing
问题解决
修改为permissive模式即可。
[root@fazhanguo-01 resource]# setenforce 0
[root@fazhanguo-01 resource]# service mysqld start
Permissive