Eight, to retrieve lost mysql root user password
1, start the MySQL root password method to modify single-instance missing
1) First stop mysql
[root@localhost ~]# /etc/init.d/mysqld stop
Shutting down MySQL. SUCCESS!
2) Use --skip-grant-tables start mysql, login authentication, authorization ignored
[root@localhost ~]# mysqld_safe --skip-grant-tables --user=mysql & [1] 1866 [root@localhost ~]# 190919 01:16:35 mysqld_safe Logging to '/application/mysql-5.5.32/data/localhost.localdomain.err'. 190919 01:16:35 mysqld_safe Starting mysqld daemon with databases from /application/mysql-5.5.32/data [root@localhost ~]# mysql < == 登录时空密码
3) change the root password for the new password
mysql> update mysql.user set password=password('dubin') where user='root' and host='localhost'; Query OK, 1 row affected (0.13 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye
4) restart the server and then log
[root@localhost ~]# /etc/init.d/mysqld stop Shutting down MySQL.190919 01:20:07 mysqld_safe mysqld from pid file /application/mysql-5.5.32/data/localhost.localdomain.pid ended SUCCESS! [1]+ Done mysqld_safe --skip-grant-tables --user=mysql [root@localhost ~]# /etc/init.d/mysqld start Starting MySQL.. SUCCESS! [root@localhost ~]# mysql -uroot -pdubin Welcome to the MySQL monitor. Commands end with ; or \g. MySQL Connection the above mentioned id Your IS 1 Version Server: 5.5 . 32 Source Distribution's ## can not stop here should be stopped, I might with reason set to set a password should be out of service with mysqladmin
2, multi-instance start MySQL root password to modify is lost
1) Close mysql
[root@localhost ~]# kill mysqld
2) Add --skip-grant-tables startup parameters
3) method to modify the password
4) restart the service with a new password