MySQL Centos 7 中 mysqld.service 的作业失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34113689/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:27:30  来源:igfitidea点击:

Job for mysqld.service failed in Centos 7

mysqlcentos7

提问by CommonCoreTawan

OS:Centos 7 Linux 3.10.0-229.el7.x86_64

操作系统:Centos 7 Linux 3.10.0-229.el7.x86_64

MySQL: mysql57-community-release-el7-7.noarch.rpm

MySQLmysql57-community-release-el7-7.noarch.rpm

I installed MySQL server through yum. When I run systemctl start mysqldI get the following error

我通过yum. 当我运行时systemctl start mysqld出现以下错误

Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details.

mysqld.service 的作业失败。有关详细信息,请参阅“systemctl status mysqld.service”和“journalctl -xn”。

systemctl status mysqld.service

systemctl 状态 mysqld.service

MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled) 
Active: failed (Result: start-limit) since Sun 2015-12-06 03:14:54 GMT;
4min 7s ago Process: 6992 ExecStart=/usr/sbin/mysqld
--daemonize $MYSQLD_OPTS (code=exited, status=1/FAILURE) Process: 6971 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited,
status=0/SUCCESS) 
Dec 06 03:14:54 localhost.localdomain systemd[1]: mysqld.service: control process exited, code=exited status=1 
Dec 06 03:14:54 localhost.localdomain systemd[1]: Failed to start MySQL Server. 
Dec 06 03:14:54 localhost.localdomain systemd[1]: Unit  mysqld.service entered failed state. 
Dec 06 03:14:54 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart. 
Dec 06 03:14:54 localhost.localdomain systemd[1]: Stopping MySQL Server... 
Dec 06 03:14:54 localhost.localdomain systemd[1]: Starting MySQL Server...   
Dec 06 03:14:54 localhost.localdomain systemd[1]: mysqld.service start request repeated too quickly, refusing to start. 
Dec 06 03:14:54 localhost.localdomain systemd[1]: Failed to start MySQL Server. 
Dec 06 03:14:54 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state. The journal command reads Failed to start MySQL Server

Any ideas what else I should be looking at?

任何想法我还应该看什么?

回答by Manish R

Check below things to fix the issue

检查以下事项以解决问题

  1. Check the permission of mysql data dir using below command. The ownership should be mysql:mysqland the directory permission should be 700

    # ls -ld /var/lib/mysql/

  2. Check the permission of databases inside mysql data dir using below command. The ownership should be mysql:mysql for all the files inside that directory

    # ls -lh /var/lib/mysql/

  3. Check the listening network tcp ports using below command

    # netstat -ntlp

  4. Check the mysql log files for any error using below command.

    # cat /var/log/mysql/mysqld.log

  5. Try to start mysql using below command

    # mysqld_safe --defaults-file=/etc/my.cf

  1. 使用以下命令检查 mysql 数据目录的权限。所有权应该是mysql:mysql,目录权限应该是700

    # ls -ld /var/lib/mysql/

  2. 使用以下命令检查 mysql 数据目录中数据库的权限。该目录中所有文件的所有权应该是 mysql:mysql

    # ls -lh /var/lib/mysql/

  3. 使用以下命令检查侦听网络 tcp 端口

    # netstat -ntlp

  4. 使用以下命令检查 mysql 日志文件是否有任何错误。

    # cat /var/log/mysql/mysqld.log

  5. 尝试使用以下命令启动 mysql

    # mysqld_safe --defaults-file=/etc/my.cf

回答by sivaraman

For me the above answer did not help, so here is my solution.

对我来说,上面的答案没有帮助,所以这是我的解决方案。

Find out open mysqld process

找出打开的mysqld进程

ps -ef | grep mysqld

ps -ef | grep mysqld

And kill all those process

并杀死所有这些进程

pkill -9 mysqld

pkill -9 mysqld

Finally start it the same by using

最后使用相同的方式启动它

systemctl start mariadb

systemctl start mariadb

Issue resolved....

问题解决了....