在IIS上托管Wordpress时建立数据库连接时出错

在IIS上托管Wordpress时建立数据库连接时出错

问题描述:

当我使用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时,出现上述错误。

最好加

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