Basically, when i want to sop mysql server service :
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'.
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. But it will fails removing until i can first stop mysqld:
~$ ps aux | grep mysql | 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
Kill it softly first sudo kill 30882
, if it does not help, kill it with fire sudo kill -9 30882
, where 30882
is pid of mysql process.
first you can check the mysql running process by
ps -ef | grep mysql
then get the pid file path for the mysql and delete the .pid file
sudo rm path/to/.pidfile
and then run the command
sudo /etc/init.d/mysql stop
this worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With