简体   繁体   中英

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?

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

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.

不要改变任何东西,保持原样,只需打开你的 xampp 并尝试从 shell cd c://xampp/mysql/bin 访问mysql ,然后写入mysql并单击 Enter 它将打开你的数据库

Change the following line under your config code from

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

to

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

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';

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM