0

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.

4
  • 1
    See if stackoverflow.com/a/6386832/5260982 on Stack Overflow helps.
    – Dave
    Mar 28 at 19:50
  • very similar issue, unfortuntly when I apply any command I get error: 'Access denied for user 'root'@'localhost'. Account is locked.' or error: 'Access denied for user 'ODBC'@'localhost' (using password: NO)' Mar 29 at 3:15
  • I tried a re-install (it actually was a re-extract for the MySQL server zip), but the error is still persisting Mar 29 at 7:17
  • 1
    Look at the first comment on the original question (stackoverflow.com/posts/6386805/edit). You have to start the server without without the grant tables so you may bypass any and all security checks first.
    – Dave
    Mar 29 at 11:59

1 Answer 1

0

Using the method from docs.

Create an C:\init.sql file containing

ALTER USER 'root'@'localhost ACCOUNT UNLOCK

In the my.ini file

[mysqld]
init-file=C:\\init.sql

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

1

Your Answer

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

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