mysql8启启动失败 mysqld

mysql8启启动失败 mysqld,第1张

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

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

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/sjk/991945.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存