Home > Database > Mysql Tutorial > How to Reset Your MySQL Root Password in PHPMyAdmin on WAMP?

How to Reset Your MySQL Root Password in PHPMyAdmin on WAMP?

Susan Sarandon
Release: 2024-12-02 01:34:10
Original
215 people have browsed it

How to Reset Your MySQL Root Password in PHPMyAdmin on WAMP?

Lost MySQL Password Recovery in PHPMyAdmin on WAMP

Introduction

If you have forgotten your MySQL root password for PHPMyAdmin in WAMP, regaining access can be frustrating. This article provides a comprehensive solution that will allow you to reset your password and restore access without reinstalling.

Step 1: Disable Password Requirements

  • Stop the MySQL service from WAMP's control panel.
  • Edit the my.ini configuration file.
  • Add the line "skip-grant-tables" under the [wampmysqld] section.
  • Restart the MySQL service.

Step 2: Open the MySQL Console

  • Launch the MySQL console from WAMP's control panel.
  • Input the following commands to reset your password:
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
Copy after login

Note: For MySQL versions 5.7 and above, use this command instead:

UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
Copy after login

Step 3: Reactivate Password Requirements

  • Stop the MySQL service again.
  • Edit the my.ini file and remove the "skip-grant-tables" line.
  • Restart the MySQL service.

Step 4: Optional Password Expiration Disable

If you wish to prevent your password from expiring automatically, open the MySQL console and execute:

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Copy after login

Conclusion

By following these steps, you should be able to regain access to your MySQL database and PHPMyAdmin without losing any data or having to uninstall and reinstall WAMP. Always remember to keep your passwords secure and backed up to avoid future lockouts.

The above is the detailed content of How to Reset Your MySQL Root Password in PHPMyAdmin on WAMP?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template