Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Completely locked out of MySQL!

Tags:

php

mysql

wamp

I've somehow managed to completely lock myself out of MySQL on WAMP. It seems all privileges are denied for all users. The only way I can get into MySQL is via the command prompt but without entering a user. From there, I quite literally cannot do anything... all privileges are denied. I've tried updating the root password to no avail.

I've also tried completely uninstalling WAMP as well as MySQL. After uninstalling MySQL, I deleted the data directories inside them to get rid of all the info there. After re-installing WAMP, the problem persists.

Attempts to access PHPMyAdmin results in:

#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

Can anyone help??

EDIT Why are people voting to close this post...?

EDIT2 A wild secondary problem appears! What do you want to do? Answer or navigate away?

like image 682
tnw Avatar asked Jun 17 '11 13:06

tnw


1 Answers

You'll need to reset the root password using mysqladmin from the command line.

mysqladmin password your-new-root-password

Might need to specify the root user explicitly:

mysqladmin -u root password your-new-root-password

Might also help to flush privileges from mysqladmin:

mysqladmin flush-privileges

Then you might need to grant all privileges back to root. Not sure if this is necessary.

GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'your-new-password';
like image 200
Michael Berkowski Avatar answered Sep 25 '22 07:09

Michael Berkowski