17

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?

Paulie-C
  • 1,674
  • 1
  • 13
  • 29
Pablo Gonzalez
  • 1,710
  • 3
  • 21
  • 36
  • What version of `gnutls` do you have (`yum list installed gnutls `)? – dan Dec 10 '15 at 13:19
  • Can u please reformat the error lines being thrown by the service start command for readability . Also please post the last few lines from mysql error log. – Jas Dec 12 '15 at 00:13
  • I did it already. Unfortunatelly formatted code is not helpful anyway. Could you look at mysqld logs for more details? – Leos Literak Dec 15 '15 at 18:48

2 Answers2

38

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
    
Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
Manish R
  • 2,312
  • 17
  • 13
  • But what should be the permissions? drwx------ will do? That's what it is. – Kazim Zaidi Jan 25 '17 at 10:04
  • What should be the permission ? – Salman Iftikhar Jun 13 '17 at 10:52
  • The problem in my case was that I had deleted everything in `/var/log` sometime back to save space, and thus it did not contain the folder `/var/log/mysql` and `mysqld` couldn't create one because it did not have root permissions. **Fixed it** by creating one, assigning mysql:mysql as the owner and then setting permission to 700. – forumulator Jul 15 '18 at 18:23
  • @forumulator, If you start mysql with the method mentioned in point no 5, you will get to know what is the error. Like in your case mysql will complain about the missing log directory. – Manish R Jul 16 '18 at 04:27
-4

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....

blissini
  • 545
  • 1
  • 7
  • 18