如何杀死以“mysqld_safe”脚本开头的mysql?
Posted
技术标签:
【中文标题】如何杀死以“mysqld_safe”脚本开头的mysql?【英文标题】:How to kill mysql started with "mysql_safe" script? 【发布时间】:2017-03-16 04:04:53 【问题描述】:短版:我用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 和/或守护进程:
$ 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
【问题讨论】:
这里有好主意:***.com/questions/11091414/how-to-stop-mysqld? @Schipe 是的,我的许多失败尝试都来自该帖子。其中许多建议都是针对包管理器(brew 或 macport)的,因为我直接运行了mysql_safe
,所以没有帮助。其他解决方案针对 mysql,这对我没有帮助,因为一旦被杀死,mysql 进程就会重新创建。谢谢,但我正在寻找特定于 mysql_safe
的答案。
mysqladmin shutdown
当然应该有效。 mysqld_safe
应该允许 MySQL 在自愿停止时终止,而不是崩溃或被杀死,但您当然必须指定 -u
和 -p
和 mysqladmin
。
这个对我有用:***.com/questions/37879448/…
@Michael-sqlbot,如果这是初始设置并且您遇到密码问题,则不会。你可以得到auth_socket
问题。
【参考方案1】:
对于 centos 或 mint
/usr/bin# initctl
对于 ubuntu
pkill mysqld
【讨论】:
离题 .... 关于您的评论:“如果每个伙伴都做了足够的研究,那么就不需要像 stack* 这样的开放网站...您可能想再次参加帮助中心之旅以了解SO 的定义目的。含义:如果您认为 SO 的含义是关于“您没有进行自己的研究”;那么对不起,您不了解 SO 的含义!以上是关于如何杀死以“mysqld_safe”脚本开头的mysql?的主要内容,如果未能解决你的问题,请参考以下文章