--skip-grant-tables: skip authorization table
--skip-networking: Skip TCP / IP connection
Close the database
service mysqld stop
Use Safe Mode Boot
mysqld_safe --skip-grant-tables --skip-networking &
Or: An unexpected discovery
service mysqld restart --skip-grant-tables --skip-networking
Log in and change your password database
[root@db01 ~]# mysql mysql> alter user root@'localhost' identified by '123'; ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement MySQL > MySQL > the flush privileges; manual loading authorization table # mysql> alter user root@'localhost' identified by '123';
Restart the database to normal mode
[root@db01 ~]# service mysqld restart Shutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS!