linux上mariadb修改存储路径,MariaDB 修改存储路径后启动失败问题解决

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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值