获取“建立数据库连接时出错"更改 WordPress 主题文件后 [英] Getting "Error establishing a database connection" After Changing WordPress Theme's Files

查看:26
本文介绍了获取“建立数据库连接时出错"更改 WordPress 主题文件后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更改了 WordPress 主题的文件设置(使用 WinSCP)并开始收到此错误.我检查了站点的主要地址和 wp-admin 端.两者都给了我相同的基本错误.我正在使用 Google Cloud Compute 来托管运行 Apache/Debian 并安装了 WordPress 的虚拟机.

I just changed my WordPress theme's file settings (using WinSCP) and started getting this error. I checked both the site's main address and the wp-admin side. Both are giving me the same basic error. I'm using Google Cloud Compute to host a virtual machine running Apache/Debian with WordPress installed.

我在哪里检查以确保这些值是正确的?我知道数据库密码是正确的,因为我可以在我的 Google Cloud Console 中看到它.

Where do I check to make sure these values are correct? I know the DB Password is correct because I can see that in my Google Cloud Console.

但是为什么它首先给我这个错误?更改主题信息时是否还需要进行其他更改?作为参考,我在新文件夹下使用来自 Zerif Lite 主题的文件(我正在尝试创建自己的主题).我不是 100% 确定我什至有一个数据库.

But why is it even giving me this error in the first place? Is there some other changes you need to make when you change a theme's information? For reference, I'm using the files from the Zerif Lite theme under a new folder (I'm trying to create my own theme). I'm not 100% sure that I even have a database.

wp-config.php:

错误 1:

错误 2(wp-admin 站点):

虚拟机的设置:

推荐答案

尝试将 ip 作为 127.0.0.1 传递,而不是本地主机.如果这不起作用,请将您的计算引擎实例 IP 放在那个位置.如果这些东西不能解决您的问题,请进入您的 wp-config.php 并粘贴上面的 linedefine('WP_ALLOW_REPAIR', true);并保存它.在此之后再次运行您的应用程序,并查看是否出现修复数据库选项.如果是这样,然后单击修复数据库,并等待它被修复.该过程完成后,从 wp-config.php 文件中删除 WP_ALLOW_REPAIR 并再次尝试运行您的应用程序.希望它有效:).

Instead of local host try to pass ip as 127.0.0.1 . If that doesn't work , put your compute engine instance IP in place of that .If these things doesn't solve your problem, go into your wp-config.php and paste above line define('WP_ALLOW_REPAIR', true); and save it. After this run your application again , and see if a repair database option appears . If it does, then click on repair database, and wait for it to get repaired. After the process is complete, remove the WP_ALLOW_REPAIR from wp-config.php file and try running your application again . Hope it works :) .

这篇关于获取“建立数据库连接时出错"更改 WordPress 主题文件后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆