MySQL database server shutdown: mysqld crash

Basically, when I want to disable the mysql server service:

sudo /etc/init.d/mysql stop 

I get an error message:

 [FAIL] Stopping MySQL database server: mysqld failed! 

After some research to solve this problem, I followed this 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 get another error here:

 ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: NO) 

Actually, I made some mistake before doing this: DELETE * FROM mysq.user WHERE host = 'localhost'.

Now I have only one user left, and it seems that he does not have GRANT permission for anything:

 mysql> select Host, user from mysql.user; +------------------+--------------+ | Host | user | +------------------+--------------+ | % | root | +------------------+--------------+ 1 rows in set (0.00 sec 

Is there any way to handle this? Actually, I just want to remove the mysql server and install it from scratch. But it cannot be deleted until I can stop mysqld first:

~ $ 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 looks like it is failing because it cannot stop mysqld in the first place

+5
source share
2 answers

Kill him gently first sudo kill 30882 , if that doesn't help, kill him with fire sudo kill -9 30882 , where 30882 is the pid of the mysql process.

+6
source

I had the same problem. I first did

 sudo /etc/init.d/mysql restart 

and then

 sudo /etc/init.d/mysql stop 

worked.

+3
source

Source: https://habr.com/ru/post/1204716/


All Articles