WAMP - phpMyAdmin trouble with password, #1045 - Access denied for user 'root'@'localhost'

2

I've been playing around with WAMP so far I have succeeded in making a password through cmd.exe for mysql: mysqladmin -u root -p password "newpassword" <-- I used this command on Windows 7.

However, when I try getting through phpMyAdmin through the WAMPSERVER icon, a page pops up stating:

Error MySQL said:

#1045 - Access denied for user 'root'@'localhost' (using password: NO) 
phpMyAdmin tried to connect to the MySQL server, and the server rejected
the connection. You should check the host, username and password in your 
configuration and make sure that they correspond to the information given 
by the administrator of the MySQL server.

I could access this page before I set a password, no luck now.

Any help on this?

FlavorOfLife

Posted 2010-11-07T09:13:13.860

Reputation: 213

Answers

2

The error message says you are trying to log in as 'root' without a password.

If you have a default installation of phpMyAdmin,you are using the 'config' authentication, and your name and password are stored in the config.inc.php file. You can stay with 'config' authentication and change the username and password that is stored in the file. All you need to do to log in is to change the one of the strings for "Authentication type and info"

$cfg['Servers'][$i]['user'] = 'root'; 
$cfg['Servers'][$i]['password'] = 'newpassword'; //DEFAULT: '' 
$cfg['Servers'][$i]['AllowNoPassword'] = true;

While you are setting passwords, you can change to 'cookie' authentication and display a login screen, rather than storing your password in a text file. To have the log in screen appear, you have to make two changes to the the config.inc.php file and a third change is strongly recommended for security. You can see http://docs.phpmyadmin.net/en/latest/#quick_install for more information, if you want to know your other options.

I am going to list the changes in the order they occur in the file.

  1. (Recommended) Change the blowfish_secret to any random string. As the file comments say, this string is used to encrypt your password in cookie based authentication (which is what you are about to change to).

      $cfg['blowfish_secret'] = 'random string';
    
  2. Around line 19, change the authentication type to cookie

      $cfg['Servers'][$i]['auth_type'] = cookie'; /*DEFAULT: 'config'
    
  3. Delete the three lines that are storing your password. Since the lines do not contain your actual password, you could just comment them out also.

Steven

Posted 2010-11-07T09:13:13.860

Reputation: 146