2015-03-13 61 views
0

我有一个phpmyadmin.I的问题,将phpmyadmin中root用户的空密码更改为没有密码当我尝试打开phpmyadmin时收到以下错误:当我将root密码设置为“无密码”时,我无法连接到数据库

1045 - 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. Retry to connect

是否可以修复phpmyadmin,而无需重新安装它?我正在使用Mac。

回答

0

如果您已将实际的root密码更改为字符串“无密码”,那么登录应该可以正常工作,但是如果您尚未设置密码,那么请尝试使用该空白输入登录并告诉phpmyadmin您不想要尝试使用密码进行登录。

+0

我将根密码更改为字符串“无密码”。我不确定你使用空白输入是什么意思。我无法输入phpmyadmin。 – 2015-03-13 10:06:20

+0

所以你去127.0.0.1/phpmyadmin或localhost/phpmyadmin,他们都没有显示任何东西? – JammyDodger231 2015-03-13 10:08:47

0

您必须更改您的phpMyAdmin配置。在Mac上,它应该在/Sites/phpMyAdmin/config.inc.php之下。

变化AllowNoPasswordTRUE

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE; 

https://docs.oseems.com/general/web/phpmyadmin/enable-login-without-password

编辑:

由于PHPMyAdmin docs说:

$cfg['Servers'][$i]['password']:

When using $cfg['Servers'][$i]['auth_type'] set to ‘config’, this is the user/password-pair which phpMyAdmin will use to connect to the MySQL server. This user/password pair is not needed when HTTP or cookie authentication is used and should be empty.

so $cfg['Servers'][$i]['password']仅用于当您设置$cfg['Servers'][$i]['auth_type']时。它与AllowNoPassword无关:)

+0

这行代码在MAMP的config.inc.php文件中不存在,但我通过添加$ cfg ['Servers'] [$ i] ['AllowNoPassword'] = TRUE来修复它。并更改$ cfg ['Servers'] [$ i] ['password'] ='root';以emtpy字符串。现在它可以工作。感谢hlep,但是能否向我解释为什么代码没有写入并且密码是root,尽管我改为“无密码”? – 2015-03-13 10:13:23

+0

@KaloianMateev - 我更新了我的答案,所以你可以阅读'password'选项。我不知道为什么在您的实际配置中没有'AllowNoPassword' - 可能它是Mac上的默认设置?我很高兴它现在可以工作,但:) – 2015-03-13 10:20:00

相关问题