文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

启动mysql报错:Job for mysqld.service failed because the control process exited with error code.See “sys

2023-09-05 10:30

关注

环境:centOS8

按照 MySQL 安装 教程操作,到下面这步出现报错:

# systemctl start mysqldJob for mysqld.service failed because the control process exited with error code.See "systemctl status mysqld.service" and "journalctl -xe" for details.

根据提示用 systemctl status mysqld.service 看了下

# systemctl status mysqld.service● mysqld.service - MySQL 8.0 database server   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)   Active: failed (Result: exit-code) since Thu 2022-02-24 16:45:08 CST; 50s ago  Process: 64678 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)  Process: 64676 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=1/FAILURE)  Process: 64639 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0>  Process: 64615 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) Main PID: 64676 (code=exited, status=1/FAILURE)   Status: "Server startup in progress"    Error: 13 (Permission denied)Feb 24 16:45:08 iZm5e211s4jw7g4w6pgezgZ systemd[1]: Starting MySQL 8.0 database server...Feb 24 16:45:08 iZm5e211s4jw7g4w6pgezgZ systemd[1]: mysqld.service: Main process exited, code=exited,>Feb 24 16:45:08 iZm5e211s4jw7g4w6pgezgZ systemd[1]: mysqld.service: Failed with result 'exit-code'.Feb 24 16:45:08 iZm5e211s4jw7g4w6pgezgZ systemd[1]: Failed to start MySQL 8.0 database server.

大概了解是权限问题导致启动失败  Error: 13 (Permission denied)

根据 Stack Overflow 上相关问题,查了下日志

# tail -f /var/log/mysql/mysqld.log 2022-02-24T08:59:57.903279Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.2022-02-24T08:59:57.903352Z 0 [ERROR] [MY-010119] [Server] Aborting2022-02-24T08:59:57.903491Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.26)  Source distribution.2022-02-24T09:00:45.597420Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.26) starting as process 648932022-02-24T09:00:45.604647Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 40a3dc29-9550-11ec-9b66-00163e04afe8.mysqld: File '/var/lib/mysql/auto.cnf' not found (OS errno 13 - Permission denied)2022-02-24T09:00:45.604725Z 0 [ERROR] [MY-010183] [Server] Failed to create file(file: '/var/lib/mysql/auto.cnf', errno 13)2022-02-24T09:00:45.604750Z 0 [ERROR] [MY-010076] [Server] Initialization of the server's UUID failed because it could not be read from the auto.cnf file. If this is a new server, the initialization failed because it was not possible to generate a new UUID.2022-02-24T09:00:45.604831Z 0 [ERROR] [MY-010119] [Server] Aborting2022-02-24T09:00:45.605061Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.26)  Source distribution.

**注意:日志目录可能会不一样,通常长这样   /var/log/mysql

检查了下,当前用户就是root用户,但是直接用

chown -R mysql.mysql /var/lib/mysql/

并没有成功授权

root用户需要加sudo执行命令才能成功

sudo chown -R mysql.mysql /var/lib/mysql/

执行之后就可以正常启动了
 

来源地址:https://blog.csdn.net/qq_36296794/article/details/123117151

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯