我无法在xampp中连接到我的MySQL我有这个错误:
MySQL说:文档
1045 - 用户'root'@'localhost'拒绝访问(使用密码:否)
mysqli_real_connect():( HY000/1045):拒绝访问用户'root'@'localhost'(使用密码:NO)phpMyAdmin尝试连接MySQL服务器,服务器拒绝连接.您应该检查配置中的主机,用户名和密码,并确保它们对应于MySQL服务器管理员提供的信息.
CONFIG.INC.PHP文件
<?php
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
/* 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';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
/*
* End of servers configuration
*/
Run Code Online (Sandbox Code Playgroud)
?>
guz*_*uer 14
找到了解决方案,在我的配置文件中,我刚刚更改了
$cfg['Servers'][$i]['auth_type'] = 'config';
Run Code Online (Sandbox Code Playgroud)
至
$cfg['Servers'][$i]['auth_type'] = 'HTTP';
Run Code Online (Sandbox Code Playgroud)
小智 9
/* Authentication type and info */
$cfg['Servers'][$i]['password'] = '';<----your password
Run Code Online (Sandbox Code Playgroud)
or
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
Run Code Online (Sandbox Code Playgroud)
to
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'your user';
$cfg['Servers'][$i]['controlpass'] = 'your password';
Run Code Online (Sandbox Code Playgroud)
@guzuer
更改值
$cfg['Servers'][$i]['user'] = 'groot';
$cfg['Servers'][$i]['password']='groot';
Run Code Online (Sandbox Code Playgroud)
在你的 ~/xampp/phpMyAdmin/config.inc.php
这里我的用户名是groot,密码是groot。
在撰写此答案时,我遇到了这个问题,我通过查找您的问题解决了这个问题。
小智 8
您可能已经为用户“root”设置了不同的密码,或者您的密码已被更改。我有同样的错误:
mysqli_real_connect(): (HY000/1045): 用户 'root'@'localhost' 访问被拒绝(使用密码:YES)
我发现 phpmyAdmin 的 root 密码在 'mysql' 和 'phpmyadmin' 数据库上都不相同,所以我更新了与 'mysql' 数据库相同的 'phpmyadmin' 数据库的密码,如下所示:
须藤 gedit /etc/phpmyadmin/config-db.php
并更新字段
$dbuser='root';
$dbpass='myNewPassword'; <-- 在此处更新您的新密码
最好的祝愿!
小智 7
我以前也遇到过这种情况:转到 windows 的路径
C:\xampp\phpMyAdmin\
转到 linux 的路径:
/etc/phpmyadmin/
发现文件名是:
config.inc.php 打开文件
更改:
['password'] = ''
Run Code Online (Sandbox Code Playgroud)
到:
['password'] = 'root'
Run Code Online (Sandbox Code Playgroud)
此默认值
如果您从控制面板更改了它,则它可能是任何密码
归档时间: |
|
查看次数: |
116666 次 |
最近记录: |