修改 MariaDB 路径到 home 路径下,mysql
执行 systemctl start mariadb 启动MariaDB 时,报错提示:linux
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 查看报错详情sql
[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 路径的权限vim
解决方法:code
1. 关闭 selinuxserver
2. 修改 存储路径权限, blog
chown -R mysql:mysql /home/mysql_data chmod -R 764 /home/mysql_data
3. 若是你的存储路径是home 下面的路径,那么接下来是重点:it
vim /etc/systemd/system/mariadb.service.d/homedir.conf
输入如下内容mariadb
[Service] ProtectHome=false
而后执行class
systemctl daemon-reload
重启mariadb
systemctl start mariadb