Failed to stop mysqld services

Running services mysqld stop or /etc/rc.d/init.d/mysqld stop [failed]

First, do this : # ps -ef | grep mysqld
If showing up :
# /usr/libexec/mysqld --defaults-f lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking

Look in to /var/run/mysqld to find mysqld.pid
# cd /var/run/mysqld
# ll

If there’s no mysqld.pid inside /var/run/mysqld directory, create mysqld.pid
# touch mysqld.pid

Assign chown to a mysqld.pid file
# chown -R mysql:mysql mysqld.pid
Why do we assign mysql:mysql to the file?
Because the warning shows –user=mysql

Assign chmod to a mysqld.pid file
# chmod g=rw mysqld.pid
# chmod o= mysqld.pid

It changes permission to a format : -rw-rw----

Assign chown to the directory, /var/run/mysqld. Why? because the owner permission for this directory isn’t mysql.
# chown mysql:mysql /var/run/mysqld

Restart Server
# reboot

Stop mysqld
# /etc/rc.d/init.d/mysqld stop
Result : [ok]

Start mysqld
# /etc/rc.d/init.d/mysqld start
Result : [ok]

Check log
# vi /var/log/mysqld.log

2 Comments to “Failed to stop mysqld services”

  1. Anjana 17 January 2009 at 1:02 pm #

    Hi

    Thanks for the article. This saved me a lots of time stopping one stubborn mysqld.

    Regards
    Anjana

  2. kinchaa 14 December 2009 at 2:55 am #

    Very good!
    Thanks …


Leave a Reply