Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm having trouble restarting the mysql service

[root ~]# service mysqld restart
Stopping MySQL:                                            [FAILED]
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]

From the mysqld.log

131004 10:34:49  mysqld started
131004 10:34:52  InnoDB: Started; log sequence number 0 43655
131004 10:34:52 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
131004 10:34:52 [ERROR] Do you already have another mysqld server running on port: 3306 ?
131004 10:34:52 [ERROR] Aborting

131004 10:34:52  InnoDB: Starting shutdown...
131004 10:34:54  InnoDB: Shutdown completed; log sequence number 0 43655
131004 10:34:54 [Note] /usr/libexec/mysqld: Shutdown complete

131004 10:34:54  mysqld ended

Processes

# ps -Af | grep mysql
root     24965     1  0 08:39 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --user=mysql
mysql    25018 24965 43 08:39 ?        00:57:11 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --open-files-limit=65535 --socket=/var/lib/mysql/mysql.sock
root     27960 27143  0 10:50 pts/0    00:00:00 grep mysql

It almost seems like there's 2 mysqlds running, one of them zombie. How can I fix this?

share|improve this question
    
With mysql stopped, run netstat -tanp and see if anything is still listening on 3306. Also, when you look at top do you see mysql in the process list? Links to advice for getting rid of zombie processes are in my answer to another question here: serverfault.com/questions/12503/… –  nedm Oct 4 '13 at 17:45
add comment

4 Answers

up vote 3 down vote accepted

try

ps -Af

to find the other mysqld running and then kill it.

share|improve this answer
1  
This is probably a better choice than top (which I suggested in my comment above) as it will provide more detail. +1 –  nedm Oct 4 '13 at 17:51
    
I added the output to the question –  Steve Robbins Oct 4 '13 at 17:51
1  
@SteveRobbins As mentioned by Pazis, kill it using kill command that accepts the process ID as argument. If your server has pkill command, you can kill by process name. –  Pothi Oct 5 '13 at 4:25
add comment

try sudo netstat -lntup and look for port 3306, if MySQL is still listening that means it was not killed, use the kill command as suggested in other comments and check the init scripts to see why is it not stopping MySQL.

share|improve this answer
add comment

Generally when you can't stop mysql it's due to not being able to shut it down via mysqladmin.. Run the following to see if it shuts down

 mysqladmin shutdown

If that doesn't work then you need to set the password for it in the init script or the /root/.my.cnf file or another my.cnf file.

share|improve this answer
add comment

Reboot your VM or server, the zombie mysql should not start then.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.