Retrieving Access to a Lost MySQL Password for PHPMyAdmin in WAMP
Problem:
A user has changed the password for their 'root'@'localhost' account in PHPMyAdmin but has subsequently lost access to PHPMyAdmin due to forgetting the new password. The methods suggested in previous forums (such as resetting the password via command line) have not been successful due to a lack of privileges.
Solution:
Here is a step-by-step process to reset the MYSQL 'root' password:
-
Stop the MySQL service: Go to WAMPSERVER, select MySQL, and choose "Service" > "Stop Service."
-
Edit the my.ini file: Go to WAMPSERVER > MySQL > my.ini.
-
Locate the [wampmysqld] section: Add the line "skip-grant-tables" directly below this section heading.
-
Restart the MySQL service: Go to WAMPSERVER > MySQL > Service > "Start/Resume Service."
-
Open the MySQL console: Go to WAMPSERVER > MySQL > MySQL Console.
-
Reset the root user password:
- Pre MySQL version 5.7: Enter "UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES;"
- Post MySQL version 5.7: Enter "UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES;"
-
Exit the MySQL console: Type "quit" at the mysql command prompt.
-
Stop the MySQL service again: Go to WAMPSERVER > MySQL > Service > "Stop Service."
-
Remove the skip-grant-tables parameter: Edit the my.ini file, locate the [wampmysqld] section, and remove the "skip-grant-tables" line.
-
Restart the MySQL service: Go to WAMPSERVER > MySQL > Service > "Start/Resume Service."
Optional: If desired, modify the settings so that the root user account does not have an expiring password by running the following query in the MySQL console: "ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;"
By following these steps, users can regain access to PHPMyAdmin using the 'root' user ID and their newly assigned password.
The above is the detailed content of How to Reset a Lost MySQL Password for PHPMyAdmin in 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