修改 MariaDB 路径到 home 路径下,
执行 systemctl start mariadb 启动MariaDB 时,报错提示:
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
systemctl status mariadb.service 查看报错详情
[Warning] Can‘t create test file /home/data/mariadbData/localhost.lower-test mariadb.service: main process exited, code=exited, status=1/FAILURE Failed to start MariaDB 10.3.9 database server.
问题的原因是因为 mariadb 没有 home 路径的权限
解决方法:
1. 关闭 selinux
2. 修改 存储路径权限,
chown -R mysql:mysql /home/mysql_data chmod -R 764 /home/mysql_data
3. 如果你的存储路径是home 下面的路径,那么接下来是重点:
vim /etc/systemd/system/mariadb.service.d/homedir.conf
输入以下内容
[Service] ProtectHome=false
然后执行
systemctl daemon-reload
重启mariadb
systemctl start mariadb
原文地址:https://www.cnblogs.com/dizhiyaochang/p/9501991.html
时间: 2024-10-12 04:39:41