You are not logged in.

#1 2010-03-23 20:50:20

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

MySQL Fails To Restart

I don't understand this issue so I am posting this here. I noticed today that I had an issue with restarting MySQL on my server:

1. I verify MySQL is not running:

[root@ghost /]# ps -ef | grep -i "mysqld"
root      1706  1216  0 16:45 pts/0    00:00:00 grep --color=auto -i mysqld

2. I start the 'mysqld' service:

[root@ghost /]# /etc/rc.d/mysqld start
:: Starting MySQL Server                                                                     [DONE]

3. I verify that the daemon is running:

[root@ghost /]# ps -ef | grep -i "mysqld"
root      1715     1  0 16:45 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql
mysql     1813  1715  0 16:45 pts/0    00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/ghost.err --pid-file=/var/lib/mysql/ghost.pid --socket=/var/run/mysqld/mysqld.sock --port=3306

4. I then run the command to restart the daemon for MySQL and it fails...

[root@ghost /]# /etc/rc.d/mysqld restart
:: Stopping MySQL Server                                                                                                                                      [DONE] 
:: Starting MySQL Server                                                                                                                                      [FAIL]

I can use the 'start' and 'stop' commands for /etc/rc.d/mysqld but 'restart' for some reason fails and this concerns me. Can anyone help me understand what is wrong?


./

Offline

#2 2010-03-24 17:40:42

timm
Member
From: Wisconsin
Registered: 2004-02-25
Posts: 417

Re: MySQL Fails To Restart

Check your log files for any info from the mysql daemon and post what you find.  On a restart does the "stop" show a fail, or the "start", or both?

Offline

#3 2010-03-24 18:05:55

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: MySQL Fails To Restart

No fails in logs at all. When I restart, it sucessfully stops but fails to start the daemon. I was told this:

When you stop MySQL, the kill command completes immediately, while MySQL
is still doing shutdown tasks to make sure the database is in a
consistent state. As MySQL is still running when you try to start it, it
will fail to do so.
There's 2 ways to fix this:
- use mysqladmin shutdown, needs a user in the database with process
privileges, this is the way used by debian
- implement a loop that waits for MySQL to shutdown after executing the
kill command. This is what the upstream MySQL start/stop script does.

I don't know if this is correct or not but it seems strange to me...


./

Offline

#4 2010-03-24 18:16:51

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: MySQL Fails To Restart

Maybe this is the problem, i mean, when you use restart to stop and start the daemon, Mysql cannot shutdown immediately and when it is started get the problem. Only guessing.

Last edited by n0dix (2010-03-24 18:17:06)

Offline

#5 2010-03-24 23:31:19

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: MySQL Fails To Restart

I understand what you're saying but I would think developers would have noticed this and work something into the 'restart' script for the MySQL package. I don't have this problem on any other distribution except Arch Linux. In my opinion the script should work as expected. I will file a bug and hope someone gets this resolved. If MySQL can 'restart' properly for Debian, I would think the same can be done for Arch Linux.

I guess I really posted here to see if anyone else running MySQL can replicate the problem.


./

Offline

#6 2010-03-28 04:35:06

timm
Member
From: Wisconsin
Registered: 2004-02-25
Posts: 417

Re: MySQL Fails To Restart

I tried a restart on my system and got the same problem.  I don't know if this is the way it always worked or if this is a new issue.

Offline

#7 2010-03-28 23:43:16

btwxt
Member
Registered: 2009-12-14
Posts: 34

Re: MySQL Fails To Restart

Try editing the line /etc/rc.d/mysqld from this:

restart)
    $0 stop
    sleep 3
    $0 start

To this:

restart)
    $0 stop
    sleep 8
    $0 start

Seems like it's not getting enough time to shut down properly since it works normally on a 'start' call.

Offline

#8 2010-03-29 12:53:57

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: MySQL Fails To Restart

Thanks! That looks / sounds promising. I will give it a shot and report back.

Am I the only person running MySQL who has a failure upon 'restart' like shown above? I was expecting fellow Arch users to also report they get the same thing but nobody has done so and I am wondering if I am the only one or if it's something only on my system.

Last edited by Carlwill (2010-03-29 12:55:01)


./

Offline

#9 2010-03-29 16:21:36

btwxt
Member
Registered: 2009-12-14
Posts: 34

Re: MySQL Fails To Restart

Carlwill: 

I had never noticed before but mine did the same exact thing.  The above fix did the trick, though. 

smile

Offline

#10 2010-03-29 16:23:38

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: MySQL Fails To Restart

Thanks! Worked for me too.


./

Offline

#11 2010-03-29 18:56:57

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: MySQL Fails To Restart

I also have this problem. I think a bug report is in order.


Website - Blog - arch-home
Arch User since March 2005

Offline

#12 2010-03-29 18:59:55

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: MySQL Fails To Restart

Has anyone filed one? If not I am going to...


./

Offline

Board footer

Powered by FluxBB