2017-12-18 447 views
2

當我使用Web Platform Installer安裝wordpress時,出現此錯誤。在IIS上託管Wordpress時建立數據庫連接時出錯

Error establishing a database connection 
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at 127.0.0.1. This could mean your host’s database server is down. 

Are you sure you have the correct username and password? 
Are you sure that you have typed the correct hostname? 
Are you sure that the database server is running? 

我可以成功安裝的情況下,IIS和WordPress的文件夾是在同一臺機器上。

但是,當我在IIS上安裝wordpress並將該應用程序指向某個網絡上的其他虛擬機的ther文件夾時,出現此錯誤。 所以,很明顯IIS會看到該文件夾​​(其他非WordPress網站,ASP.NET以這種方式設置),但其他問題是問題。我試着在wp-config中放入不同的東西。 /** MySQL主機名*/ define('DB_HOST','127.0.0.1');

這是Windows Server 2016,我不得不改變註冊表中的某些東西來成功安裝Wordpress,但我不認爲這是問題,因爲現在已經安裝了wordpress。但是,當我訪問http://example.com/blogging/wp-admin/install.php時,出現上述錯誤。

回答

0

最好加

define('WP_ALLOW_REPAIR', true); 
中的wp-config.php文件

,並嘗試修復你的數據庫連接。 有時添加本地主機IP端口號將解決問題,請試試這個

define('DB_HOST', '127.0.0.1:8889'); 
+1

應該是一個評論。 – Thamaraiselvam

+0

是的。我做到了。我可以將它成功安裝到另一臺服務器上(使用更簡單的設置(所有服務器都在同一臺服務器上) –

+0

雖然此鏈接可能回答此問題,但最好在此處包含答案的基本部分並提供供參考的鏈接。 - [發表評論](/ review/low-quality-posts/18286645) – the4kman

相關問題