iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >启动mysql报错:Job for mysqld.service failed because the control process exited with error code.See “sys
  • 686
分享到

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

mysqllinux 2023-09-05 10:09:17 686人浏览 八月长安
摘要

环境:Centos8 按照 MySQL 安装 教程操作,到下面这步出现报错: # systemctl start MysqldJob for mysqld.service failed because the control process

环境: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.
  • 系统检测到是第一次启动的服务,创建了一个新的UUID
  • 由于没有权限,'/var/lib/mysql/auto.cnf' 文件未创建成功,导致UUID不能写入auto.cnf
  • 新服务的初始化失败,服务启动失败

**注意:日志目录可能会不一样,通常长这样   /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

您可能感兴趣的文档:

--结束END--

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

本文链接: https://www.lsjlt.com/news/395135.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作