Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux General Discussion (http://www.linux-archive.org/archlinux-general-discussion/)
-   -   MySQL Starts But Fails to Restart (http://www.linux-archive.org/archlinux-general-discussion/346071-mysql-starts-but-fails-restart.html)

Carlos Mennens 03-24-2010 01:46 AM

MySQL Starts But 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:

Code:

[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:

Code:

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

3. I verify that the daemon is running:

Code:

[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...

Code:

[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?

Jan de Groot 03-24-2010 06:39 AM

MySQL Starts But Fails to Restart
 
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.

On Tue, 2010-03-23 at 22:46 -0400, Carlos Mennens wrote:
> 4. I then run the command to restart the daemon for MySQL and it fails...
>
> Code:
>
> [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?


All times are GMT. The time now is 10:27 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.