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

Linux文章/教程评论651阅读模式
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 配置的日志目录并没有创建文章源自爱尚资源教程网-https://www.23jcw.net/1754.html

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

所以直接创建授权
说明:我这里配置的log-error的路径是在/var/log/mariadb 底下,创建的路径根据自己的实际路径来配置,注意一定也别忘了创建mariadb.log,要不然还是会报错文章源自爱尚资源教程网-https://www.23jcw.net/1754.html

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

mysql 用户和用户对目录进行授权文章源自爱尚资源教程网-https://www.23jcw.net/1754.html

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

再次启动mysql服务文章源自爱尚资源教程网-https://www.23jcw.net/1754.html

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

或者文章源自爱尚资源教程网-https://www.23jcw.net/1754.html

/etc/init.d/mysqld start

其他的方式启动按照自己的实际情况来进行执行文章源自爱尚资源教程网-https://www.23jcw.net/1754.html 文章源自爱尚资源教程网-https://www.23jcw.net/1754.html

相关文章
版权声明:文章图片资源来源于网络,如有侵权,请留言删除!!!
  • 温馨提示:如遇到资源下载不了,或者文章没有解决你的问题的,可以联系我们帮你处理!!!
  • 转载请务必保留本文链接:https://www.23jcw.net/1754.html

发表评论