如何杀死mysql以“mysql_safe”脚本开头?

时间:2016-11-02 18:04:21

标签: mysql server daemon kill-process

短版:我用mysql_safe启动了mysql,我无法杀死它。

长版本:使用macport安装旧版本的mysql会显示以下建议:

$ sudo port install mysql55-server
--->  Computing dependencies for mysql55-server
--->  Fetching archive for mysql55-server
--->  Attempting to fetch mysql55-server-5.5.49_0.darwin_14.noarch.tbz2 from https://packages.macports.org/mysql55-server
--->  Attempting to fetch mysql55-server-5.5.49_0.darwin_14.noarch.tbz2.rmd160 from https://packages.macports.org/mysql55-server
--->  Installing mysql55-server @5.5.49_0
--->  Activating mysql55-server @5.5.49_0

If this is a new install you might want to run:

$ sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db

运行它给出了这些说明:

$ sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db
Installing MySQL system tables...
161102 13:15:44 [Note] /opt/local/lib/mysql55/bin/mysqld (mysqld 5.5.49) starting as process 54176 ...
OK
Filling help tables...
161102 13:15:44 [Note] /opt/local/lib/mysql55/bin/mysqld (mysqld 5.5.49) starting as process 54180 ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/opt/local/lib/mysql55/bin/mysqladmin -u root password 'new-password'
/opt/local/lib/mysql55/bin/mysqladmin -u root -h myusername password 'new-password'

Alternatively you can run:
/opt/local/lib/mysql55/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt/local ; /opt/local/lib/mysql55/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /opt/local/mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

此时我(不明智,似乎)跑了:

$ cd /opt/local ; /opt/local/lib/mysql55/bin/mysqld_safe &

现在我无法弄清楚如何停止mysql和/或daemondo进程:

$ ps aux | grep mysql55
myusername        54937   0.1  0.0  2432772    660 s001  R+    1:39PM   0:00.00 grep mysql55
_mysql         54888   0.0  0.1  2667884   6340   ??  S     1:36PM   0:00.12 /opt/local/lib/mysql55/bin/mysqld --user=_mysql
root           54885   0.0  0.0  2479468    700   ??  Ss    1:36PM   0:00.00 /opt/local/bin/daemondo --label=mysql55-server --start-cmd /opt/local/lib/mysql55/bin/mysqld --user=_mysql ; --pid=exec

我尝试过很多kill的变种,目标是mysql(看起来毫无意义)和daemondo,包括(但不限于)以下内容:

  • sudo kill -9 54888 // killing the mysql process results in a new pid
  • sudo kill 54885 // the doemondo process
  • sudo kill -SIGHUP 54885
  • sudo killall mysqld_safe
  • sudo kill -9 54822 // a reincarnation of the doemondo process
  • sudo mysqladmin shutdown

1 个答案:

答案 0 :(得分:0)

对于centos或薄荷

 /usr/bin# initctl 

表示ubuntu

 pkill mysqld