简体   繁体   English

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

[英]Error establishing a database connection while hosting Wordpress on IIS

I get this error when I install wordpress using Web Platform Installer. 当我使用Web Platform Installer安装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?

I can successfully install it in case IIS and wordpress folder are on the same machine. 我可以成功安装它 ,以防IIS和wordpress文件夹在同一台机器上。

But I get this error when I install wordpress on IIS and point that application to ther folder which is on some network but other virtual machine. 但是当我在IIS上安装wordpress并将该应用程序指向某个网络上的其他虚拟机的文件夹时,我收到此错误。 So, obviously IIS sees that folder (other non wordpress sites, ASP.NET are setup this way) but something else is problem. 所以,很明显IIS看到了那个文件夹(其他非wordpress网站,ASP.NET就是这样设置的),但其他东西是有问题的。 I tried putting different things inside wp-config. 我尝试在wp-config中放入不同的东西。 /** MySQL hostname */ define('DB_HOST', '127.0.0.1'); / ** MySQL主机名* / define('DB_HOST','127.0.0.1');

It is Windows Server 2016, and I had to change something in registry to succesfully install Wordpress, but I don't think that is problem because wordpress is now installed. 它是Windows Server 2016,我不得不在注册表中更改某些内容以成功安装Wordpress,但我认为这不是问题因为现在安装了wordpress。 But when I visit http://example.com/blogging/wp-admin/install.php I get error mentioned above. 但是,当我访问http://example.com/blogging/wp-admin/install.php时,我收到上述错误。

Better add 更好的补充

define('WP_ALLOW_REPAIR', true);

in wp-config.php and try to repair your db connection. 在wp-config.php中尝试修复数据库连接。 Sometimes adding port number with localhost ip will fix the issues, please try this too 有时使用localhost ip添加端口号将解决问题,请尝试此操作

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM