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

时间:2012-11-12 06:50:35

标签: php phpmyadmin xampp localhost

当我尝试访问我的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.

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

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

?>

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

6 个答案:

答案 0 :(得分:14)

尝试这些步骤

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

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

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

  4. 重启XAMPP

  5. here is full description with image

答案 1 :(得分:4)

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

只需使用此设置 - >在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'] = '';

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

答案 2 :(得分:2)

不要改变任何东西,放在那里,只需打开你的xampp并尝试从shell cd c:// xampp / mysql / bin 访问mysql 的 MySQL的 然后单击“输入”将打开您的数据库

答案 3 :(得分:1)

更改配置代码下的以下行
$cfg['Servers'][$i]['password'] = 'password';

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

答案 4 :(得分:1)

如果更改了XAMPP-> MySQL端口(默认端口为3306),则必须将新端口添加到phpMyAdmin文件中:

xampp phpmyadmin access denied error(#2002)

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

来自: $cfg['Servers'][$i]['host'] = '127.0.0.1';
到:
$cfg['Servers'][$i]['host'] = '127.0.0.1:3308';

答案 5 :(得分:0)

尝试使用相同的身份验证凭据从命令行登录数据库。这样您就可以验证您确实使用了正确的身份验证凭据,例如用户名和密码。如果您在命令行上失败,问题不在于phpmyadmin,而在于您的数据库引擎设置。