Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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??

share|improve this question
1  
It appears that the root user's password is not being provided for the login attempt. –  KayakJim Jun 16 '11 at 22:00
    
@KayakJim Good work, that's exactly what my error message says. Have you ever used WAMP before? –  tnw Jun 17 '11 at 15:10

1 Answer 1

Add the following line to your my.cnf or my.ini and restart the mysql server:

skip-grant-tables

Then change the password in mysql.user table

update user set password = password('newpassword') where user = 'root'

Remove the skip line and restart the server. You will be able to login with the new password.

share|improve this answer
    
Using the second command in MySQL gives me an error: No database selected. –  tnw Jun 17 '11 at 13:51
    
Change the second command to be: update mysql.user set password = password('newpassword') where user = 'root' –  KayakJim Jun 17 '11 at 15:14
    
@KayakJim @ghm1014 UPDATE command denied... –  tnw Jun 17 '11 at 15:27
    
After MySQL is restarted with the skip-grant-tables option, are you able to access the database via PHPMyAdmin? If so, navigate to the mysql database, select the user table, and edit the root user record to reset the password. Be sure to select PASSWORD for the Function. –  KayakJim Jun 17 '11 at 15:33
    
@KayakJim No, now I simply get 404 not found for all my localhost pages, including phpMyAdmin –  tnw Jun 17 '11 at 15:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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