Job for mysqld.service failed in Centos 7

CommonCoreTawan picture CommonCoreTawan · Dec 6, 2015 · Viewed 68.2k times · Source

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?

Answer

Manish R picture Manish R · Dec 14, 2015

Check below things to fix the issue

  1. Check the permission of mysql data dir using below command. The ownership should be mysql:mysql and 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