CentOS MySQL server won't start

January 11, 2015 41.5k views

Hey,

I have installed MySQL on my CentOS 7 server, but it won’t start. When i try to start it with the command “sudo service mysqld start” i get the message “Job for mysqld.service failed. See ‘systemctl status mysqld.service’ and 'journalctl -xn’ for details.” after about 5 minutes.

I have searched Google all day, and just can’t find a solution..

Log:
150111 10:06:40 mysqldsafe A mysqld process already exists
150111 10:20:35 mysqld
safe A mysqld process already exists
150111 10:30:35 mysqldsafe A mysqld process already exists
150111 10:40:35 mysqld
safe A mysqld process already exists

Please help…

1 comment
  • I am not familiar with CentOS, but had a similar issue in Ubuntu. I was able to use this:

    /etc/init.d/mysql stop
    /etc/init.d/mysql start

4 Answers

You are running CentOS 7. Run this:

systemctl status mysqld.service

If no errors show up, try this:

systemctl restart mysqld.service

If that fails, run this:

for i in `ps auxf|grep mysqld|grep "grep" -v|awk '{print $2}'`; do kill -9 $i; done

Then, run this:

systemctl start mysqld.service

And finally, to ensure it is working:

systemctl status mysqld.service

Reinstalling MySQL might help.
First uninstall,
then delete the /var/lib/mysql and /etc/my.cnf or /etc/my.cnf.rpmsave,
then Restart,
then Install.

Had the same problem.
Use command :

sudo tail -f /var/log/messages|grep -i mysql

to check if SELinux policy is causing the issue. If so, first check if SELinux policy is enables using command #sestatus. If it shows enabled, than disable it.
To disable,
i)# vi /etc/sysconfig/selinux
ii)change ‘SELINUX=enforcing’ to 'SELINUX=disabled’
iii)restart linux
iv)check with 'sestatus’ and it should show “disabled”

Uninstall and reinstall mysql. It should be working.

Have another answer? Share your knowledge.