xampp localhost phpmyadmin用户'root'@'localhost'拒绝访问(使用密码:YES)

use*_*331 7 php xampp localhost phpmyadmin

当我尝试访问我的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.
Run Code Online (Sandbox Code Playgroud)

我不知道我做错了什么...这是我的配置代码...

$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'] = '';

?>
Run Code Online (Sandbox Code Playgroud)

我注意到很多代码被注释掉了,我应该对它进行评论吗?

Nul*_*teя 14

尝试这些步骤

  1. 在phpmyadmin目录中打开config.inc.php文件

  2. 找到第21行: $cfg['Servers'][$i]['password'] = ''

  3. 将其更改为: $cfg['Servers'][$i]['password'] = 'your_password';

  4. 重启XAMPP

这里是图像的完整描述


小智 6

花了这么多时间后,我才知道是。

只需使用此设置-> 打开 phpmyadmin 目录中的 config.inc.php 文件

/* 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'] = '';
Run Code Online (Sandbox Code Playgroud)

您应该有一个@localhost 主机名的用户。现在 phpmyadmin 会要求你输入密码。如果您提供正确的密码,您将能够登录。


小智 2

不要更改任何内容,按原样放置,只需打开 xampp 并尝试从 shell cd c://xampp/mysql/bin访问 mysql ,然后写入 mysql 并单击 Enter 它将打开您的数据库