记录一次mysql启动报错mysqld: File ‘./binlog.index‘ not found (OS errno 13 - Permission denied)
查看日志,查看报错问题
[root@localhost ~]# tail -n50 /var/log/mysqld.log
发现是权限问题
- 解决方法1:
对datadir
目录赋予mysql
权限
# 查看datadir [root@localhost ~]# grep 'datadir' /etc/my.cnf datadir=/data/mysql [root@localhost ~]# chown -R mysql:mysql /data/mysql
- 解决方法2:
关闭selinux
# 临时生效 [root@localhost ~]# setenforce 0 # 永久生效,需要重启系统 [root@localhost ~]# sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config [root@localhost ~]# reboot
再次重启mysql
成功
[root@localhost ~]# systemctl start mysqld