Centos8上安装mysql8遇到SELinux is preventing /usr/libexec/mysqld from write access on the directory mysql
問題描述
mysql8安裝后數據默認存儲路徑/var/lib/mysql,修改默認存儲路徑后遇到如下報錯:
SELinux is preventing /usr/libexec/mysqld from write access on the directory mysql. For complete SELinux messages run: sealert -l 233b1c8f-ef7>
網上做法
我的做法
使用chcon命令為mysql數據目錄設置selinux權限,并啟動mysql,發現啟動成功:
chcon -R -t mysqld_db_t /home/mysql是因為:
mysqld_db_t 這種文件類型用于標記MySQL數據庫數據文件;
在RHEL/CentOS中數據文件的默認位置是“/var/lib/mysql”;
如果修改了MySQL數據文件的位置,新的位置必須使用這種類型標簽。
參考鏈接:
https://zh.wikipedia.org/wiki/%E5%AE%89%E5%85%A8%E5%A2%9E%E5%BC%BA%E5%BC%8FLinux
https://zhuanlan.zhihu.com/p/30483108
http://aiezu.com/article/mysql_selinux_config.html
http://aiezu.com/article/linux_chcon_command.html
總結
以上是生活随笔為你收集整理的Centos8上安装mysql8遇到SELinux is preventing /usr/libexec/mysqld from write access on the directory mysql的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2021 年第十三届四川省 ACM-IC
- 下一篇: C# partial