2016-06-21 66 views
0

使用什麼,但愚蠢我已經設法從我的MySql數據庫中刪除本地主機訪問,所以PhpMyAdmin不會運行,雖然簡單的示例腳本仍然運行良好。我昨天才開始使用它,所以會感激一點幫助?PhpMyAdmin - 本地主機訪問是否可以恢復?

{ 
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. 
} 

這是工作前衛的片段,從W3C的網站,它適用於任何有效的用戶和失敗的人。爲什麼phpmyadmin不能運行,以及什麼配置文件已被重寫?

{ 
$servername = "localhost"; 
$username = "root"; 
$password = ""; 
$dbname = "sql_learn"; 

try { 
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username,$password); 
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
$stmt = $conn->prepare("SELECT _id, _gibb FROM gibberish"); 
$stmt->execute(); 

// set the resulting array to associative 
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC); 
foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) { 
    echo $v; 
} 
+0

你是如何刪除其訪問權限的? – Chay22

+0

我被這個'信息'消息弄糊塗了,並試圖斷開本地主機。餿主意。 {允許任何用戶從本地主機連接的用戶帳戶存在。如果其帳戶的主機部分允許來自任何(%)主機的連接,這將阻止其他用戶連接。} –

回答

1

我不知道你做了什麼或改變,但是如果你使用像XAMPP或WAMP你總是可以只是去./xampp/phpmyadmin目錄和config.sample.inc.php的內容複製到config.inc.php,並填寫您的設置。

+0

工作,謝謝。 –