Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Job for mysqld.service failed in Centos 7

Tags:

mysql

centos7

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?

like image 341
CommonCoreTawan Avatar asked Dec 06 '15 03:12

CommonCoreTawan


1 Answers

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
    
like image 109
Manish R Avatar answered Sep 19 '22 22:09

Manish R