mysql8启启动失败 mysqld_safe error: log-error set to ‘/var/log/mariadb/mariadb.log‘

Starting MySQL.2021-11-17T11:04:25.022108Z mysqld_safe error: log-error set to '/var/log/mariadb/mariadb.log', however file don't exists. Create writable for user 'mysql'.
 ERROR! The server quit without updating PID file (/data/mysql/data/localhost.localdomain.pid).

msyql8编译安装完成后通过/etc/init.d/mysqld start 命令启动MySQL时报了以上错误,然后我就重新检查了my.cnf内容,内容如下:

[mysqld]
server-id=1
port=3306
datadir=/data/mysql/data
basedir=/usr/local/mysql
socket=/usr/local/mysql/mysql.sock
skip-grant-tables
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[client]
socket=/usr/local/mysql/mysql.sock


[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

整体my.cnf的配置没有什么问题,然后一直启动失败,最后发现是mysqld_safe 配置的日志目录并没有创建

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

所以直接创建授权

说明:我这里配置的log-error的路径是在/var/log/mariadb 底下,创建的路径根据自己的实际路径来配置,注意一定也别忘了创建mariadb.log,要不然还是会报错

mkdir /var/log/mariadb     
touch /var/log/mariadb/mariadb.log


mysql 用户和用户对目录进行授权
 

chown -R mysql:mysql /var/log/mariadb/

再次启动mysql服务
 

/usr/local/mysql/support-files/mysql.server start

或者

/etc/init.d/mysqld start

其他的方式启动按照自己的实际情况来进行执行

  • 5
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值