Premise: Forget the root password, I can't enter the database. Of course, I don't talk about the following changes. You need to do this: Linux system: launch mysql mysql.server stop safe_mysqld --skip-grant-tables --skip-networking in safe mode This way you can skip the verification of the right to enter the database directly to the database. How do you go to Windows, see if there is a skip-grant-tables parameter in MySQLD, it should be true, but the specific operation has not tried it, which is telling it a bit. After entering, the next is to modify the password: 1, restart mysql (4.1 before the version)
Use mysql> Update user set password = password ("new_pass") where user = "root";> flush privilege
Restart mysql
2, restart mysql (4.1 and after the version)
Use mysql> Update user set password = old_password ("new_pass") where user = "root";> flush privilege
Restart mysql
3, set password for root @ localhost = password ('newpassword') # 4.1 Set password for root @ localhost = Old_paot ('newpassword') # 4.1 Previous Version 4, using mysqladmin, this is a special case of the previous declaration . mysqladmin -u root -p password mypasswd