Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 06-27-2009, 12:02 PM   #1
Registered: May 2004
Location: Ireland
Distribution: Debian
Posts: 56

Rep: Reputation: 15
Can't start/stop Mysql Service

Taking over a Debian Etch web server with MySQL running.

I usually start, stop and restart msyql using:

/etc/init.d/mysql restart
For some reason on this set up I get the following:

:~# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld failed!
The mysql process is running fine:
    :~# ps aux | grep mysql 
    root      2045  0.0  0.1   2676  1332 ?        S    Jun25   0:00 /bin/sh /usr/bin/mysqld_safe
    mysql     2082  0.6 10.7 752544 111188 ?       Sl   Jun25  18:49 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/ --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
    root      2083  0.0  0.0   1568   504 ?        S    Jun25   0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
    root     11063  0.0  0.0   2856   716 pts/0    S+   17:29   0:00 grep mysql
I'm sure there are some really easy way to do it but I want to understand what is going on as well. Why is the typical way not working for me?


as an update:

    JBRLSVR001:/var/log/mysql# mysqladmin shutdown
    JBRLSVR001:/var/log/mysql# dpkg --list mysql\*
    | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed 
    |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
    ||/ Name                                         Version                                      Description
    un  mysql-client                                 <none>                                       (no description available)
    un  mysql-client-4.1                             <none>                                       (no description available)
    ii  mysql-client-5.0                             5.0.32-7etch8                                mysql database client binaries
    ii  mysql-common                                 5.0.32-7etch8                                mysql database common files (e.g. /etc/mysql /my.cnf)
    un  mysql-common-4.1                             <none>                                       (no description available)
    ii  mysql-server                                 5.0.32-7etch8                                mysql database server (meta package depending on the latest version)
    un  mysql-server-4.1                             <none>                                       (no description available)
    ii  mysql-server-5.0                             5.0.32-7etch8                                mysql database server binaries
mysqladmin shutdown does work but i'm still curious why the /etc/init.d/mysql commands aren't working.

Last edited by dereko; 06-27-2009 at 12:13 PM.
Old 06-28-2009, 03:20 PM   #2
Senior Member
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 87
I'd think the main reason is because mysql is running as a different user, not root, and mysql by default will not allow the root account to start or stop the daemon. This makes sense from a security perspective. When mysql is running, check the user it is running as.

Take a look at this command for a clue:
ps ax | grep mysql
This returns the following for me:
4365 ?        S      0:00 /bin/sh /usr/bin/mysqld_safe
 4407 ?        Sl    24:33 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/ --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
 4409 ?        S      0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
 6618 pts/0    S+     0:00 grep mysql
This reports that there are three processes running with mysql somewhere in their running. For process 4407, it is running as 'user=mysql', and it is the main mysql processes, the others are for error handling and logging.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not use exec of php function to start/stop service nui Linux - Enterprise 3 04-25-2009 10:43 AM
start und stop windows service using nagios cccc Debian 1 03-11-2008 07:43 AM
service start/stop command stalls..... CaptainInsane Fedora 2 01-20-2007 04:03 PM
start/stop service on the fly zchoyt Linux - Software 3 04-14-2005 03:30 AM
Is it possible to start stop and restart a linux service from a webpage? psychodreams Linux - Newbie 3 04-27-2004 01:24 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration