问题
OS:Centos 7 Linux 3.10.0-229.el7.x86_64
MySQL: mysql57-community-release-el7-7.noarch.rpm
I installed MySQL server through yum. When I run systemctl start mysqld I get the following error
Job for mysqld.service failed. See 'systemctl status mysqld.service' and 'journalctl -xn' for details.
systemctl status 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?
回答1:
Check below things to fix the issue
Check the permission of mysql data dir using below command. The ownership should be
mysql:mysqland the directory permission should be700# ls -ld /var/lib/mysql/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/Check the listening network tcp ports using below command
# netstat -ntlpCheck the mysql log files for any error using below command.
# cat /var/log/mysql/mysqld.logTry to start mysql using below command
# mysqld_safe --defaults-file=/etc/my.cf
回答2:
For me the above answer did not help, so here is my solution.
Find out open mysqld process
ps -ef | grep mysqld
And kill all those process
pkill -9 mysqld
Finally start it the same by using
systemctl start mariadb
Issue resolved....
来源:https://stackoverflow.com/questions/34113689/job-for-mysqld-service-failed-in-centos-7