LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Can't start/stop Mysql Service (https://www.linuxquestions.org/questions/linux-server-73/cant-start-stop-mysql-service-736040/)

dereko 06-27-2009 12:02 PM

Can't start/stop Mysql Service
 
Taking over a Debian Etch web server with MySQL running.

I usually start, stop and restart msyql using:

Code:

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

Code:

:~# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld failed!

The mysql process is running fine:
Code:

    :~# 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/mysqld.pid --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?

UPDATE

**EDIT UPDATE**
as an update:

Code:

    JBRLSVR001:/var/log/mysql# mysqladmin shutdown
    JBRLSVR001:/var/log/mysql# dpkg --list mysql\*
    Desired=Unknown/Install/Remove/Purge/Hold
    | 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.

irishbitte 06-28-2009 03:20 PM

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

ps ax | grep mysql
This returns the following for me:
Code:

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/mysqld.pid --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.


All times are GMT -5. The time now is 03:18 AM.