修改 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