Unable to login to phpMyAdmin in XAMPP: Access denied for user 'root'@'localhost' (using password: NO)

In this post we shall see how to set root password for phpMyAdmin to resolve the access de Unable to login to phpMyAdmin in XAMPP: Access denied for user 'root'@'localhost' (using password: NO)
 
Unable to login to XAMPP's phpMyAdmin page : Error #1045 - Access denied for user 'root'@'localhost' (using password: NO).
In this post we shall see how to set root password for phpMyAdmin to resolve the access denied error while accessing phpMyAdmin. This may usually happen if XAMPP is reinstalled on the same computer.
 
In earlier versions of XAMPP, after the first time installation of XAMPP, we could access http://localhost web page from where we could access links to set password for phpMyAdmin. This was usually at the link http://localhost/security/index.php. However, as I see on XAMPP v3.2.2, http://localhost takes us to http://localhost/dashboard/ page and there are no links to configure or setup password for phpMyAdmin. And if this is not a first time install and where the previous password was "root", when we access http://localhost/phpMyAdmin, we get the error: #1045 - Access denied for user 'root'@'localhost' (using password: NO).
 
How to set root password for phpMyAdmin?
If we access http://localhost there is no link to go to security like before to set password for phpMyAdmin. Refer to solutions below for different scenarios. For most first time install, accessing http://localhost/phpmyadmin will directly take us to the phpmyadmin web interface without asking for password. Because by default there is no password set. If you want to set password for accessing phpmyadmin, you can do so from the phpmyadmin web interface.
  • Open http://localhost/phpmyadmin
  • Click USER ACCOUNTS tab
  • Click on EDIT PRIVILEGE corresponding to root user<>localhost
  • Click on CHANGE PASSWORD
  • Type in the desired password for ROOT twice in the text boxes provided
  • Click GO 
  • Try accessing http://localhost/phpmyadmin. we should now be getting the error below:
    #1045 - Access denied for user 'root'@'localhost' (using password: NO)
 
ERROR #1045 - Access denied for user 'root'@'localhost' (using password: NO) when opening http://localhost/phpmyadmin

Though a password to access phpmyadmin is set as per the steps above from the phpmyadmin webinterface, access is denied - Access denied for user 'root'@'localhost' (using password: NO). This means, though there is a root password set, there is some config file where it is set not to use password. 
 
Resolve this issue by manually editing in the file "config.inc.php" located at "C:\xampp\phpMyAdmin" (the default path, otherwise, depends on your installation directory).
  • Navigate to "C:\xampp\phpMyAdmin"
  • Find the file "config.inc.php" and open in a Notepad or better, Notepad++
  • At line # 18 to 24, is the settings for authentication looks like this:
 /* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ' ';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
 
As seen above:
auth_type = config: authentication type is from configuration
user: is set to root
password: password is not set in the configuration file
AllowNoPassword=true: configuration settings is set to allow without password

  • Change the above values to :

 /* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root ';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Lang'] = '';
 
  • Save the file
  • Try accessing http://localhost/phpmyadmin. 
We should now get a login page to enter userame and password to enter phpmyadmin
 successfully.
In this post we shall see how to set root password for phpMyAdmin to resolve the access de Unable to login to phpMyAdmin in XAMPP: Access denied for user 'root'@'localhost' (using password: NO)


Each time, we will get this login page henceforth to enter phpmyadmin.

To change the root password for phpMyadmin, do the following:
  • Open http://localhost/phpmyadmin
  • Click USER ACCOUNTS tab
  • Click on EDIT PRIVILEGE corresponding to root user<>localhost
  • Click on CHANGE PASSWORD
  • Type in the desired password for ROOT twice in the text boxes provided
  • Click GO  
 
 

 

Related Posts

Comments

Subscribe Our Newsletter