关于php:xampp本地主机phpmyadmin用户’root’@’localhost’的访问被拒绝(使用密码:是)

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

当我尝试进入phpmyadmin localhost

时出现两个错误

1
2
3
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.

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$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'] = '';

?>

我注意到很多代码已被注释掉,我应该取消注释吗?


尝试这些步骤

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

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

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

  • 重新启动XAMPP

  • 这是图像

    的完整描述


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

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

    1
    2
    3
    4
    5
    6
    7
    /* 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会要求您输入密码。如果您提供正确的密码,您将可以登录。


    不要更改任何内容,直接放在其中,只需打开xampp并尝试在写完后从shell cd c:// xampp / mysql / bin访问mysql
    MySQL的
    然后单击Enter,它将打开您的数据库


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

    xampp phpmyadmin访问被拒绝错误(#2002)

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

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


    的配置代码下更改以下行

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

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

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