繁体   English   中英

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

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

当我使用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?

我可以成功安装它 ,以防IIS和wordpress文件夹在同一台机器上。

但是当我在IIS上安装wordpress并将该应用程序指向某个网络上的其他虚拟机的文件夹时,我收到此错误。 所以,很明显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中尝试修复数据库连接。 有时使用localhost ip添加端口号将解决问题,请尝试此操作

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

暂无
暂无

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

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