By accident I locked my root account in MySQL which I launch using wamp server, the error message from phpMyAdmin is

Access denied for user 'root'@'localhost'. Account is locked.

How can I unlock this account, all I could find online was assuming that I have another unlocked account. Thanks in advance.


1 Answer 1


Using the method from docs.

Create an C:\\init.sql file containing

ALTER USER 'root'@'localhost' ACCOUNT UNLOCK

In the my.ini file


Restart the service, check you can access the root user, and then remove init.sql file and backout my.ini change.

per ALTER USER docs


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.