记一次 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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通