Access denied for user 'root'@'localhost' with PHPMyAdmin

Sam picture Sam · Jul 14, 2012 · Viewed 150.8k times · Source

When I set the root password in PHPMyAdmin, I get this error:

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

I can't open the PHPMyAdmin panel. What am I doing wrong?

Answer

Sathishkumar picture Sathishkumar · Jul 14, 2012

Edit your phpmyadmin config.inc.php file and if you have Password, insert that in front of Password in following code:

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = '**your-root-username**';
$cfg['Servers'][$i]['password'] = '**root-password**';
$cfg['Servers'][$i]['AllowNoPassword'] = true;