root@debian:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.19 MySQL Community Server (GPL)
$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
$ pgrep mysql
28315
$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
$ pgrep mysql
28570
$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
$ pgrep mysql
28763
..... etc ...
幸运的是,下面的命令已经解决了这个问题:
$ sudo service mysql stop
mysql stop/waiting
$ ps -ef | grep mysql
29841 26858 0 10:59 pts/8 00:00:00 grep --color=auto mysql <--- IT's gone !
-- MySQL version < 5.7
update user set password=PASSWORD("mynewpassword") where User='root';
-- MySQL 5.7, mysql.user table "password" field -> "authentication_string"
update user set authentication_string=password('mynewpassword') where user='root';