Fix Access Denied for User 'Root'@'Localhost' for PHPmyadmin

Access denied for user 'root'@'localhost' after installing phpmyadmin on ubuntu

This error can be fixed, the following command will reconfigure your phpMyAdmin credentials to gain access to the MYSQL DB:

sudo dpkg-reconfigure phpmyadmin

/!\ This will provide few interactive menus that will allow you to reconfigure the phpMyAdmin package with NEW credentials /!\

But you could also reconfigure it manually :

1 - Log into mysql as root

mysql -u root -p

2 - Make sure 'phpmyadmin' user exists :

SELECT User FROM mysql.user;

3 - Switch to the appropriate MYSQL DB :

use phpmyadmin;

4 - Set new password for the phpmyadmin user

UPDATE user SET password=PASSWORD('yourNewPassword') WHERE User='phpmyadmin';

MySQL Error: : 'Access denied for user 'root'@'localhost'

  1. Open and edit /etc/my.cnf or /etc/mysql/my.cnf, depending on your distribution.
  2. Add skip-grant-tables under [mysqld]
  3. Restart MySQL
  4. You should be able to log in to MySQL now using the below command mysql -u root -p
  5. Run mysql> flush privileges;
  6. Set new password by ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
  7. Go back to /etc/my.cnf and remove/comment skip-grant-tables
  8. Restart MySQL
  9. Now you will be able to login with the new password mysql -u root -p

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

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;

phpMyAdmin access denied

try this in your phpmyadmin config.inc.php :-

    $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'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;


Related Topics



Leave a reply



Submit