Linux 环境下mysql数据库启动失败解决

环境介绍

Linux:腾讯云服务器:CentOS 7.6 64bit
mysql:Server version: 8.0.26 MySQL Community Server

安装参考贴

[菜鸟驿站](https://www.runoob.com/mysql/mysql-install.html)

遇到的问题

在启动 MySQL:systemctl start mysqld 后系统提示服务启动失败。

Starting mysqld (via systemctl):  Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
                                                           [FAILED]

解决问题

定位问题

1、通过查看mysql的日志,发现是一个文件权限的问题。
查看日志

2021-09-29T08:31:42.480432Z 0 [ERROR] [MY-010076] [Server] Initialization of the server's UUID failed because it read from the auto.cnf file. If this is a new server, the initialization failed because it was not possible to w UUID.
2021-09-29T08:31:42.480491Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-09-29T08:31:42.481033Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.26) ity Server - GPL.
2021-09-29T08:37:50.902988Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.26) starting as process
2021-09-29T08:37:50.910660Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that irst time that this server has been started. Generating a new UUID: 881f32f5-2100-11ec-bf9f-525400fdd633.
mysqld: File '/var/lib/mysql/auto.cnf' not found (OS errno 13 - Permission denied) (权限不足 chmod 777 auto.cnf之后即可)
2021-09-29T08:37:50.910770Z 0 [ERROR] [MY-010183] [Server] Failed to create file(file: '/var/lib/mysql/auto.cnf'
2021-09-29T08:37:50.910805Z 0 [ERROR] [MY-010076] [Server] Initialization of the server's UUID failed because it read from the auto.cnf file. If this is a new server, the initialization failed because it was not possible to w UUID.
2021-09-29T08:37:50.910892Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-09-29T08:37:50.911657Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.26) ity Server - GPL.

2、仔细查看这段输出日志的信息,主要提示的是问卷找不到或者权限不足。

mysqld: File '/var/lib/mysql/auto.cnf' not found (OS errno 13 - Permission denied) (权限不足 chmod 777 auto.cnf之后即可)

3、查看该路径下这个文件的权限
原始权限

解决步骤

首先改变这个文件的权限。(我这里直接给最高的权限了)
修改权限
修改后权限
此时重新启动mysql service 成功。
启动成功

  • 6
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值