记一次 mysql 不能启动问题的流水账

 linux 下启动 mysql 报错(#为提示字符)

1
# systemctl restart mysqld

 报错 如下

[ERROR] InnoDB: Operating system error number 13 in a file operation.
[ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
[ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Failed to initialize builtin plugins.
[ERROR] Aborting 

此时考虑是由 selinux 引起的问题
临时方案 : 关闭 selinux

1 # getenforce # 查看selinux 状态 “Enforcing” 为selinux 强制开启 。“Permissive” 为 selinux 只 监控不阻止命令 执行 
2 # setenforce 0 # 修改selinux为 Permissive 

selinux 修改后,重新尝试 启动mysql ,成功。

再次修改selinux为 Enforcing 后 ,重新出现“Operating system error number 13 in a file operation.”


 

问题:如何保持selinux 的强安全模式 且 mysql 服务正常 ?
答: 修改 selinux的mysql安全配置项

1 # getsebool -a |grep mysql
2 mysql_connect_any --> off
3 selinuxuser_mysql_connect_enabled --> off

问:如何打开 配置项

1 # setsebool -P selinuxuser_mysql_connect_enabled on
2 # setsebool -P mysql_connect_any on

修改selinux为 Enforcing 后 ,mysql 服务正常 。


 

参考文献:

https://www.percona.com/doc/percona-server/8.0/security/selinux.html

posted @   独思则滞而不通  阅读(420)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示