2015-03-13 23 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

相關問題