3

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?

1
  • 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, 2013 at 17:45

4 Answers 4

5

try

ps -Af

to find the other mysqld running and then kill it.

3
  • 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, 2013 at 17:51
  • I added the output to the question Oct 4, 2013 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. Oct 5, 2013 at 4:25
2

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.

1

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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .