Operating System: DEBIAN Linux 3.1.
MYSQL database version: 5.0.27
(1) log on with the system root permission
(2) Stop the MYSQL server:
Mysql. server stop
(3) skip the authorization table and execute the MYSQL server:
Mysqld_safe -- skip-grant-tables -- skip-networking &
(Note: The parameter -- skip-grant-tables indicates that the authorization table is skipped; -- skip-networking indicates that the TCP/IP connection is not monitored)
(4) execute the MYSQL client:
Mysql
(5) use the mysql database
Use mysql;
(6) Update the root password
Update user set password = password ('new password') where user = 'root ';
(7) shut down the mysql server and start it with the normal side.
If you are not using this version, you can find a mysqld_safe suitable for your current version in the mysql installation directory, followed by -- skip-grant-tables to skip the authorization table, the mysqld_safe version I used in my book is "safe_mysqld" (actually, I think I 've remembered it here. Where did I see that I changed sqfe_mysqld to mysqld_safe after 5.0, this caused me to find it online for a long time)