2016-09-25 134 views
0

當我去localhost/phpmyadmin,就這樣表示:如何設置phpMyAdmin的用戶名和密碼?

enter image description here

但是如何設置用戶名和密碼。

我曾嘗試在終端:

mysql -u root -p 

但它說:

ERROR 1045(28000):拒絕訪問用戶 '根' @ 'localhost' 的(使用 密碼: YES)

如果鍵入用戶名:root和密碼:[空白]

它顯示我:

enter image description here

+0

你試過鍵入用戶:根;密碼:保留空白?更多信息:http://stackoverflow.com/a/5818385/5153030 – alljamin

+0

嗨@alljamin,我試過留空,但當我點擊去按鈕,它沒有任何東西。 – Khuong

回答

1

嘗試搜索一個名爲:的config.inc.php在你的系統和你選擇的編輯器打開它。

然後或者$cfg['Servers'][$i]['AllowNoPassword']搜索,並將其設置爲True:$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

,或者如果你想使用密碼登錄(注意,只有當你想不用密碼登錄用)(推薦 )定位:

$cfg['Servers'][$i]['password']並設置密碼,像這樣:

$cfg['Servers'][$i]['password'] = 'your_password'; 
+0

嗨@coder,我打開config.inc.php文件,但我沒有看到'$ cfg ['Servers'] [$ i] ['AllowNoPassword']'這一行。 – Khuong

+0

嗨@coder,我只看到config.sample.inc.php,我沒有看到config.inc.php,但在config.sample.inc.php中,我看到這個'$ cfg ['Servers'] [$ I] [ 'AllowNoPassword']'。但是,當我設置爲true時,它不起作用。 – Khuong

+0

@Khuong,config.sample.inc.php只是一個最小的配置文件,在你的情況下,如果config.inc.php文件丟失,你將不得不手動創建一個文件。要做到這一點看看這裏:http://docs.phpmyadmin.net/en/latest/setup.html#manually-creating-the-file – coder