user979331
user979331

Reputation: 11961

xampp localhost phpmyadmin Access denied for user 'root'@'localhost' (using password: YES)

I am getting two errors when I try to go to my phpmyadmin localhost

Access denied for user 'root'@'localhost' (using password: YES)

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 don't know what I am doing wrong...here is my config code...

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/* 
 * Servers configuration
 */
$i = 0;

/* 
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'password';
$cfg['Servers'][$i]['connect_type'] = 'socket'; 
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
/* User for advanced features */
//$cfg['Servers'][$i]['controluser'] = 'pmauser';
//$cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
//$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
//$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
//$cfg['Servers'][$i]['relation'] = 'pma_relation';
//$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
//$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
//$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
//$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
//$cfg['Servers'][$i]['history'] = 'pma_history';

/* 
 * End of servers configuration
 */

/*
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

?>

I notice a lot of code is commented out, should I un-commented it?

Upvotes: 10

Views: 99544

Answers (7)

133_Rythmn Magnani
133_Rythmn Magnani

Reputation: 11

Hey if none of troubleshoots are working for you then I have a solution because none of the solution worked for me and only these two step worked.

Step 1 -> go to C:\xampp and right click on xampp-control.exe and click on properties go to compatibility and check the run this program as administrator and click apply:

properties setting of xampp-control.exe'image'

Step 2 -> (MOST IMP STEP) Sometimes no matter how much you try to change the port number in config file or in other phpMyAdmin file XAMPP will listen to some specific port which you can see here:

XAMPP snapshot'image'

even if the config file of MySQL says some other port but xampp will listen to this port only and just see this port number and go to C:\xampp\phpMyAdmin then go in config.inc.php and write

$cfg['Servers'][$i]['port'] = 2023;

remember 2023 is the port which was showing me in the xampp control panel it could be something else for you. I am sure this will work :)

Upvotes: 1

Mike
Mike

Reputation: 995

If the XAMPP->MySQL Port was changed, (default port is 3306) the new port must be added to the phpMyAdmin file:

xampp phpmyadmin access denied error(#2002)

C:\xampp\phpMyAdmin\config.inc.php

from:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
to :
$cfg['Servers'][$i]['host'] = '127.0.0.1:3308';

Upvotes: 2

vikash
vikash

Reputation: 186

Don't change anything , put as it was there , just open your xampp and try to access mysql from shell cd c://xampp/mysql/bin after this write mysql and click enter it will open your databases

Upvotes: 3

Junaid
Junaid

Reputation: 2470

After spending so much time what i came know is.

Just use this setting-> Open config.inc.php file in the phpmyadmin directory

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;  
$cfg['Lang'] = '';

You should have one user with @localhost host name. Now phpmyadmin will ask you for password. if you provide correct password,You will be able to login.

Upvotes: 7

000
000

Reputation: 3950

Change the following line under your config code from

$cfg['Servers'][$i]['password'] = 'password';

to

$cfg['Servers'][$i]['password'] = '';

Upvotes: 2

arkascha
arkascha

Reputation: 42984

Try to login to the database from command line using the same authentication credentials. This way you verify that you are really using the correct authentication credentials like username and password. If you fail on command line the problem is not with phpmyadmin but with your database engine setup.

Upvotes: 0

NullPoiиteя
NullPoiиteя

Reputation: 57332

try these step

  1. Open config.inc.php file in the phpmyadmin directory

  2. Find line 21: $cfg['Servers'][$i]['password'] = ''

  3. Change it to: $cfg['Servers'][$i]['password'] = 'your_password';

  4. Restart XAMPP

here is full description with image

Upvotes: 17

Related Questions