3

On doing /etc/init.d/mysql stop

I see the message

* Stopping MySQL database server mysqld
   ...done.

....which seems mysql has stopped.

But when i run ps aux | grep -i mysql , i still see mysql in it. I try to kill it (no error seen), and yet it continues to run on a different process the next instant.

Output of ps aux | grep -i mysql -->

mysql    13625  0.2  5.6 624028 57628 ?        Ssl  18:09   0:00 /usr/sbin/mysql
d
root     13793  0.0  0.0  11980   944 pts/2    S+   18:11   0:00 grep --color=au
to -i mysql 

On trying to kill...

root@thesite:~# ps aux | grep -i mysql
mysql    13822  0.0  5.9 624028 60356 ?        Ssl  18:19   0:00 /usr/sbin/mysql
d
root     14112  0.0  0.0  11980   948 pts/2    S+   18:24   0:00 grep --color=au
to -i mysql
root@thesite:~# kill -9 13822
root@thesite:~# ps aux | grep -i mysql
mysql    14130  7.5  5.3 624028 54904 ?        Ssl  18:24   0:00 /usr/sbin/mysql
d
root     14288  0.0  0.0  11980   944 pts/2    S+   18:24   0:00 grep --color=au
to -i mysql

And on killing the parent ID of mysql -

root@mysite:~# kill -9 624028 624028
-bash: kill: (624028) - No such process
-bash: kill: (624028) - No such process

On running - ps -ef | grep mysqld | grep -v grep

root@thesite:~$ sudo ps -ef | grep mysqld | grep -v grep
mysql    14393     1  0 18:36 ?        00:00:00 /usr/sbin/mysqld

On running -

username@thesite:~$ ps -auxwf -f

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         2  0.0  0.0      0     0 ?        S    Oct24   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [ksoftirqd/
0]
root         5  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [kworker/0:
0H]
root         7  0.0  0.0      0     0 ?        S    Oct24   0:04  \_ [rcu_sched]

root         8  0.0  0.0      0     0 ?        S    Oct24   0:06  \_ [rcuos/0]
root         9  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [rcu_bh]
root        10  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [rcuob/0]
root        11  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [migration/
0]
root        12  0.0  0.0      0     0 ?        S    Oct24   0:09  \_ [watchdog/0
]
root        13  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [khelper]
root        14  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [kdevtmpfs]

root        15  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [netns]
root        16  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [writeback]

root        17  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [kintegrity
d]
root        18  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [bioset]
root        20  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [kblockd]
root        21  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [ata_sff]
root        22  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [khubd]
root        23  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [md]
root        24  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [devfreq_wq
]
root        27  0.0  0.0      0     0 ?        S    Oct24   0:01  \_ [khungtaskd
]
root        28  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [kswapd0]
root        29  0.0  0.0      0     0 ?        SN   Oct24   0:00  \_ [ksmd]
root        30  0.0  0.0      0     0 ?        SN   Oct24   0:06  \_ [khugepaged
]
root        31  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [fsnotify_m
ark]
root        32  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [ecryptfs-k
threa]
root        33  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [crypto]
root        45  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [kthrotld]
root        47  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [vballoon]
root        48  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [scsi_eh_0]

root        49  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [scsi_eh_1]

root        70  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [deferwq]
root        71  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [charger_ma
nager]
root       118  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [kpsmoused]

root       125  0.0  0.0      0     0 ?        S    Oct24   0:07  \_ [jbd2/vda1-
8]
root       126  0.0  0.0      0     0 ?        S<   Oct24   0:00  \_ [ext4-rsv-c
onver]
root       153  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [kworker/0:
2]
root      1244  0.0  0.0      0     0 ?        S    Oct24   0:00  \_ [kauditd]
root     11033  0.0  0.0      0     0 ?        S    Oct26   1:21  \_ [kworker/0:
0]
root     28406  0.0  0.0      0     0 ?        S<   Nov02   0:00  \_ [kworker/u3
:1]
root      3095  0.0  0.0      0     0 ?        S<   Nov03   0:00  \_ [kworker/u3
:0]
root      6404  0.0  0.0      0     0 ?        S    08:00   0:00  \_ [kworker/u2
:1]
root     11110  0.0  0.0      0     0 ?        S    16:57   0:02  \_ [kworker/u2
:0]
root         1  0.0  0.2  33444  2688 ?        Ss   Oct24   0:06 /sbin/init
root       306  0.0  0.0  19472   644 ?        S    Oct24   0:00 upstart-udev-br
idge --daemon
root       311  0.0  0.1  51220  1492 ?        Ss   Oct24   0:00 /lib/systemd/sy
stemd-udevd --daemon
root       449  0.0  0.0  15256   648 ?        S    Oct24   0:00 upstart-socket-
bridge --daemon
root       500  0.0  0.2  10220  2908 ?        Ss   Oct24   0:21 dhclient -1 -v
-pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclien
message+   743  0.0  0.1  39212  1340 ?        Ss   Oct24   0:00 dbus-daemon --s
ystem --fork
syslog     776  0.0  1.3 256036 14016 ?        Ssl  Oct24   0:19 rsyslogd
root       788  0.0  0.1  43448  1852 ?        Ss   Oct24   0:00 /lib/systemd/sy
stemd-logind
root       806  0.0  0.0  15272   628 ?        S    Oct24   0:00 upstart-file-br
idge --daemon
root       856  0.0  0.0  16056   964 tty4     Ss+  Oct24   0:00 /sbin/getty -8
38400 tty4
root       858  0.0  0.0  16056   952 tty5     Ss+  Oct24   0:00 /sbin/getty -8
38400 tty5
root       861  0.0  0.0  16056   960 tty2     Ss+  Oct24   0:00 /sbin/getty -8
38400 tty2
root       862  0.0  0.0  16056   952 tty3     Ss+  Oct24   0:00 /sbin/getty -8
38400 tty3
root       864  0.0  0.0  16056   960 tty6     Ss+  Oct24   0:00 /sbin/getty -8
38400 tty6
root       890  0.0  0.1  23652  1040 ?        Ss   Oct24   0:06 cron
memcache 19991  0.0  0.1 325392  1176 ?        Sl   Oct24   0:38 /usr/bin/memcac
hed -m 64 -p 11211 -u memcache -l 127.0.0.1
root     30309  0.0  0.1  85876  1484 ?        Ss   Oct25   0:00 nginx: master p
rocess /usr/sbin/nginx
www-data 30311  0.0  0.1  86172  1796 ?        S    Oct25   0:52  \_ nginx: work
er process
www-data 30312  0.0  0.2  86528  2708 ?        S    Oct25   0:13  \_ nginx: work
er process
www-data 30313  0.0  0.2  86528  2708 ?        S    Oct25   0:41  \_ nginx: work
er process
www-data 30314  0.0  0.2  86528  2704 ?        S    Oct25   0:48  \_ nginx: work
er process
root     11510  0.0  0.1  25580  1864 ?        Ss   Oct26   0:08 /usr/lib/postfi
x/master
postfix  14102  0.0  0.1  27404  1640 ?        S    18:21   0:00  \_ pickup -l -
t unix -u -c
postfix  14103  0.0  0.1  27568  1784 ?        S    18:21   0:00  \_ qmgr -l -t
unix -u
ntp      23013  0.0  0.2  31444  2096 ?        Ss   Oct28   0:38 /usr/sbin/ntpd
-p /var/run/ntpd.pid -g -u 103:109
root      2617  0.0  1.4 265784 15248 ?        Ss   Oct29   0:27 php-fpm: master
 process (/etc/php5/fpm/php-fpm.conf)
www-data 21118  0.0  3.4 276640 35160 ?        S    Nov01   0:08  \_ php-fpm: po
ol www
www-data 21153  0.0  2.9 275468 29880 ?        S    Nov01   0:05  \_ php-fpm: po
ol www
www-data 21155  0.0  3.2 274764 33180 ?        S    Nov01   0:08  \_ php-fpm: po
ol www
root      6645  0.0  0.8 187352  8544 ?        Sl   Oct29   2:35 /usr/bin/python
 /usr/bin/fail2ban-server -b -s /var/run/fail2ban/fa
root     10958  0.0  0.2  78180  2172 tty1     Ss   Oct30   0:00 /bin/login --

root     10535  0.0  0.3  22644  3572 tty1     S+   16:55   0:00  \_ -bash
root     17842  0.0  0.2 110244  2124 ?        S    Nov01   0:16 searchd
root     12947  0.0  0.3  61364  3064 ?        Ss   17:11   0:00 /usr/sbin/sshd
-D
root     14318  0.0  0.4 105628  4244 ?        Ss   18:33   0:00  \_ sshd:
tus [priv]
username 14336  0.0  0.1 105628  1904 ?        S    18:33   0:00      \_ sshd: username @pts/2
username 14337  0.0  0.3  22724  3632 pts/2    Ss   18:33   0:00          \_ -ba
sh
username 14577  0.0  0.1  18812  1364 pts/2    R+   18:43   0:00              \_
 ps -auxwf -f
mysql    14393  0.0  5.7 624028 58480 ?        Ssl  18:36   0:00 /usr/sbin/mysql
d
5
  • Can you include the output of the ps aux | grep -i mysql call? – ceejayoz Nov 4 '15 at 17:17
  • Sure, just edited my post and added :) – codemode Nov 4 '15 at 18:13
  • Please run ps -ef | grep mysqld | grep -v grep and post that output. – RolandoMySQLDBA Nov 4 '15 at 18:36
  • @RolandoMySQLDBA ..updated – codemode Nov 4 '15 at 18:40
  • kill it with SIGTERM so it exits gracefully – akuzminsky Nov 4 '15 at 19:41
2

You're stopping it with /etc/init.d/mysql stop. Upstart/systemd or whatever Ubuntu uses then thinks it crashes and starts it again. You need to do service mysql stop probably.

I had this issue myself.

2
  • ... that actually worked. Now i feel stupid. lol – codemode Nov 4 '15 at 19:43
  • Don't feel bad. It's a bug that they don't remove the init script. Try restarting ssh that way. It says nothing, just doesn't work. And you wondering why your change isn't taking effect... – Halfgaar Nov 4 '15 at 22:28
1

To get the process id, use the following command:

ps-ef|grep mysql

Example

ps-ef|grep mysql
mysql     1290     1  0 Nov03 ?        00:02:41 /usr/sbin/mysqld

Use the following command to kill:

sudo kill -9 <mysql_process_id>
1
  • ...no luck, mysql restarts in another id – codemode Nov 4 '15 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.