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?

Steve Robbins
  • 1,932
  • 5
  • 23
  • 26
  • 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: http://serverfault.com/questions/12503/what-is-a-zombie-process-and-how-do-i-kill-it/12510#12510 – nedm Oct 04 '13 at 17:45

4 Answers4

5

try

ps -Af

to find the other mysqld running and then kill it.

Ali Hashemi
  • 288
  • 1
  • 5
  • 15
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.

APZ
  • 954
  • 2
  • 12
  • 25
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.

Mike
  • 22,310
  • 7
  • 56
  • 79
0

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

Thomas Decaux
  • 1,289
  • 12
  • 13