mysqld Errcode:13 解决方法

当看到错误日志里面如下记录:

mysqld started

[Warning] Can’t create test file xxx.lower-test
[Warning] Can’t create test file xxx.lower-test
/usr/libexec/mysqld: Can’t change dir to ‘/xxx’ (Errcode: 13)

[ERROR] Aborting

首先检查数据目录和日志目录的权限和所属用户,如果权限和所属用户都没问题,那应该是SELINUX的权限限制了。

先查看当前配置信息.

# getenforce

Enforcing

就表明SELinux已经启用.只需要关闭即可。

关闭方法:

#setenforce 0 (0|1 开|关)

对你的数据目录和日志目录执行如下命令:

#chcon (更多…)