Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I've been using WAMP server for a while and I have several databases on the mysql server.

today I installed microsoft webmatrix and when I opened one of my sites on wamp I got a mysql error saying the connection has failed, and when I try to open the phpmyadmin it says access denied.

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

I guess it somehow changed the password for my user, so how can I reconnect to wamp's phpmyadmin and restore my old databases?

Currently I can connect to the server with the password ' ' (space) but my databases are gone.

EDIT: ok I changed the password back to '' (null) using an sql command

SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere');

is it possible to restore the old dbs?

share|improve this question
add comment

migrated from stackoverflow.com Dec 6 '12 at 20:37

This question came from our site for professional and enthusiast programmers.

2 Answers

Here is the only thing I can advise for now:

Open a DOS Window and run the following

C:\> dir mysql.user /s

If you see two mysql.user files, then you may have two DB setups.

You would just have to point datadir in my.cnf back to the old setup.

Please find out and let me know ...

share|improve this answer
    
thank's I just manually restored it all –  Dotan Reis Dec 9 '12 at 10:34
add comment

If you didn't remove or modify the default accounts, you may be inadvertently connecting with one of those instead of the account you think you're connecting with.

Examples below are from a server that definitely has more databases than the two shown, but connecting using an unexpected username which matches one of the default account, which has an empty username and password.

$ mysql --user=bogus --password='' # this is an empty string, not a space

mysql> show grants;
+--------------------------------------+
| Grants for @localhost                |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)

mysql>

If this is what you're seeing, then this could be what's happening. Your data may all be intact but you're not signing in as the user that you think you are -- because you're matching that anonymous account, which has very few permissions.

The SHOW GRANTS statement will tell you who you are really connected as.

share|improve this answer
add comment

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.