阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

centos8部署MySQL5.7故障集

31次阅读
没有评论

共计 2098 个字符,预计需要花费 6 分钟才能阅读完成。

导读 在 centos8 系统上安装 MySQL,使用的是 centos7 上安装 MySQL 的脚本,出现了以下问题,以做记录:

centos8 部署 MySQL5.7 故障集

问题一:日志文件不存在,MySQL 无法启动

错误日志:

[root@confluence packages]# /etc/init.d/mysqld restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL.2022-01-15T03:58:44.753030Z mysqld_safe error: log-error set to '/var/log/mariadb/mariadb_error.log', however file don't exists. Create writable for user'mysql'.
 ERROR! The server quit without updating PID file (/home/confluence/mysql/mysql_data/confluence.pid).
1.2.3.4.
原因和解决方法:

根据日志提示,MySQL 无法启动是因为指定的日志文件 /var/log/mariadb/mariadb_error.log 不存在
touch 创建 /var/log/mariadb/mariadb_error.log,并修改权限为 mysql:mysql,该错误解决。

问题二:/etc/my.cnf 文件为空,MySQL 无法启动

错误日志:

[root@confluence packages]# /etc/init.d/mysqld start
Starting MySQL.. ERROR! The server quit without updating PID file (/home/confluence/mysql/mysql_data/confluence.pid).
[root@confluence packages]#

1.2.3.

原因和解决方法:

原因是 /etc/my.cnf 文件是空的,什么配置都没有。
查看 /etc/my.cnf,文件没有配置数据目录等信息,文件内容如下:

[root@confluence mysql]# cat /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[root@confluence mysql]# 
1.2.3.4.5.6.7.8.9.10.11.12.13.
/etc/my.cnf.d 目录下只存在 client.cnf 一个文件,内容也是空的:[root@confluence mysql]# cat /etc/my.cnf.d/client.cnf 
#
# These two groups are read by the client library
# Use it for options that affect all clients, but not the server
#
[client]
# This group is not read by mysql client library,
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]
[root@confluence mysql]# 
1.2.3.4.5.6.7.8.9.10.11.12.

把 /etc/my.cnf 文件补充完整,问题即解决。

问题三:/etc/my.cnf 文件权限过大导致 MySQL 无法启动

错误日志:

[root@confluence etc]# /etc/init.d/mysqld start
my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored.
Starting MySQL.my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored.
my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored.
.. ERROR! The server quit without updating PID file (/home/confluence/mysql/mysql_data/confluence.pid).
[root@confluence etc]#
原因和解决方法:

原因是因为 /etc/my.cnf 文件是从其它节点拷贝拷贝过来的,上传后默认的权限过大。把 /etc/my.cnf 文件的权限改成 644,重新启动 MySQL 则成功。

阿里云 2 核 2G 服务器 3M 带宽 61 元 1 年,有高配

腾讯云新客低至 82 元 / 年,老客户 99 元 / 年

代金券:在阿里云专用满减优惠券

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2024-07-25发表,共计2098字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中