0

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?

2 Answers 2

1

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

0
0

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.

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.