Regaining Access to Lost MySQL Password on WAMP: A Step-by-Step Guide
Losing access to your MySQL password can be a daunting experience, especially when working with PHPMyAdmin on WAMP. However, there's a relatively simple solution that allows you to reset your root password and regain control.
Steps to Reset Root Password:
-
Stop MySQL Service: Navigate to WAMPManager, select MySQL, and stop the service.
-
Edit my.ini File: Go to MySQL in WAMPManager and open the my.ini file.
-
Add skip-grant-tables: Locate the [wampmysqld] section and add the line "skip-grant-tables" directly after it.
-
Restart MySQL Service: Resume the MySQL service in WAMPManager.
-
Open MySQL Console: Click on MySQL Console in WAMPManager.
-
Reset Password: Execute the following commands (with semicolons):
Pre-MySQL 5.7:
- UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
- FLUSH PRIVILEGES;
Post-MySQL 5.7:
- UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
- FLUSH PRIVILEGES;
-
Exit MySQL: Type "quit" and press ENTER to exit the console.
-
Stop MySQL Service: Stop the MySQL service in WAMPManager again.
-
Edit my.ini File: Remove the skip-grant-tables parameter you added earlier.
-
Restart MySQL Service: Resume the MySQL service in WAMPManager.
Additional Considerations:
Once you complete these steps, you should be able to log into PHPMyAdmin using the 'root' user with your newly set password.
The above is the detailed content of How Do I Reset My Lost MySQL Root Password on WAMP?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn