php xampp localhost phpmyadmin 用户 'root'@'localhost' 访问被拒绝(使用密码:YES)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13339416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xampp localhost phpmyadmin Access denied for user 'root'@'localhost' (using password: YES)
提问by user979331
I am getting two errors when I try to go to my phpmyadmin 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.
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?
我注意到很多代码被注释掉了,我应该取消注释吗?
采纳答案by vikash
Don't change anything , put as it was there , just open your xampp and try to access mysql from shell cd c://xampp/mysql/binafter this write mysqland click enter it will open your databases
不要改变任何东西,保持原样,只需打开你的 xampp 并尝试从 shell cd c://xampp/mysql/bin 访问mysql,然后写入 mysql并单击 Enter 它将打开你的数据库
回答by NullPoiиteя
try these step
试试这些步骤
Open config.inc.php file in the phpmyadmin directory
Find line 21:
$cfg['Servers'][$i]['password'] = ''Change it to:
$cfg['Servers'][$i]['password'] = 'your_password';Restart XAMPP
打开phpmyadmin目录下的config.inc.php文件
找到第 21 行:
$cfg['Servers'][$i]['password'] = ''将其更改为:
$cfg['Servers'][$i]['password'] = 'your_password';重启 XAMPP
回答by Armaan
After spending so much time what i came know is.
花了这么多时间之后,我才知道是。
Just use this setting-> Open config.inc.php file in the phpmyadmin directory
只需使用此设置-> 打开 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'] = '';
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.
您应该有一个@localhost 主机名的用户。现在 phpmyadmin 会要求你输入密码。如果您提供正确的密码,您将能够登录。
回答by 000
Change the following line under your config code from
将配置代码下的以下行从
$cfg['Servers'][$i]['password'] = 'password';
to
到
$cfg['Servers'][$i]['password'] = '';
回答by arkascha
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.
尝试使用相同的身份验证凭据从命令行登录到数据库。通过这种方式,您可以验证您是否确实使用了正确的身份验证凭据,例如用户名和密码。如果您在命令行上失败,则问题不在于 phpmyadmin,而在于您的数据库引擎设置。
回答by Mike
If the XAMPP->MySQL Port was changed, (default port is 3306) the new port must be added to the phpMyAdmin file:
如果更改了 XAMPP->MySQL 端口,(默认端口为 3306)必须将新端口添加到 phpMyAdmin 文件中:
xampp phpmyadmin access denied error(#2002)
xampp phpmyadmin 访问被拒绝错误(#2002)
C:\xampp\phpMyAdmin\config.inc.php
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';
从:$cfg['Servers'][$i]['host'] = '127.0.0.1';
到:$cfg['Servers'][$i]['host'] = '127.0.0.1:3308';

