[英]Stopping MySQL database server: mysqld failed
Basically, when i want to sop mysql server service :基本上,当我想使用 mysql 服务器服务时:
sudo /etc/init.d/mysql stop
i'm getting this error message:我收到此错误消息:
[FAIL] Stopping MySQL database server: mysqld failed!
After some research to solve this i followed this to-do step:经过一些研究来解决这个问题,我遵循了这个待办步骤:
sudo cat /etc/mysql/debian.cnf
Which gives me something like :这给了我类似的东西:
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = xXxXxXxXxXxX
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = xXxXxXxXxXxX
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
Then i did然后我做了
mysql -u root -p
And finally最后
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'xXxXxXxXxXxX' WITH GRANT OPTION;
This should have work but i'm getting another error here :这应该有用,但我在这里遇到另一个错误:
ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: NO)
Actually, i made some mistake before that, running this: DELETE * FROM mysq.user WHERE host = 'localhost'.实际上,在那之前我犯了一些错误,运行这个:DELETE * FROM mysq.user WHERE host = 'localhost'。
I now have only one user left, and it seems he doesn't have the permission to GRANT anything:我现在只剩下一个用户了,而且他似乎没有授予任何东西的权限:
mysql> select Host, user from mysql.user;
+------------------+--------------+
| Host | user |
+------------------+--------------+
| % | root |
+------------------+--------------+
1 rows in set (0.00 sec
Is there a way to handle this ?有没有办法处理这个? Actually i just want to remove mysql server and install it again from scratch.
其实我只想删除mysql服务器并从头开始重新安装它。 But it will fails removing until i can first stop mysqld:
但是在我可以先停止 mysqld 之前,它将无法删除:
~$ ps aux | ~$ ps 辅助 | grep mysql |
grep mysql | grep -v grep
grep -v grep
root 8252 0.0 0.0 12720 2776 pts/1 Ss+ 09:42 0:00 /usr/bin/dpkg --status-fd 17 --configure mysql-common:all libmysqlclient18:amd64 libdbd-mysql-perl:amd64 mysql-client-5.5:amd64 mysql-server-core-5.5:amd64 mysql-server-5.5:amd64
root 8255 0.0 0.3 61372 14180 pts/1 S+ 09:42 0:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/mysql-server-5.5.postinst configure 5.5.38-0+wheezy1
root 8265 0.0 0.0 10900 1676 pts/1 S+ 09:42 0:00 /bin/bash /var/lib/dpkg/info/mysql-server-5.5.postinst configure 5.5.38-0+wheezy1
root 8579 0.0 0.0 21656 2928 pts/1 S+ 09:50 0:00 whiptail --backtitle Configuration package tools --title mysql-server-5.5 Configuration --output-fd 11 --nocancel --msgbox Impossible to change « root » password of MySQL 13 198
root 30566 0.0 0.0 4180 728 ? S 00:41 0:00 /bin/sh /usr/bin/mysqld_safe
mysql 30882 0.0 1.9 368500 77668 ? Sl 00:41 0:16 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
root 30883 0.0 0.0 5588 696 ? S 00:41 0:00 logger -t mysqld -p daemon.error
i already tried it with :我已经尝试过:
sudo apt-get remove mysql-server mysql-client mysql-common
sudo apt-get purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get remove --purge mysql\*
And it seems it fails because it cannot stop mysqld in the first place它似乎失败了,因为它首先无法停止 mysqld
先轻轻地杀死它sudo kill 30882
,如果没有帮助,用火杀死它sudo kill -9 30882
,其中30882
是 mysql 进程的 pid。
I had the same issue.我遇到过同样的问题。 I first did
我首先做了
sudo /etc/init.d/mysql restart
and then进而
sudo /etc/init.d/mysql stop
worked.工作。
first you can check the mysql running process by首先您可以通过以下方式检查mysql运行过程
ps -ef | grep mysql
then get the pid file path for the mysql and delete the .pid file然后获取mysql的pid文件路径并删除.pid文件
sudo rm path/to/.pidfile
and then run the command然后运行命令
sudo /etc/init.d/mysql stop
this worked for me.这对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.