怎么样修复 WordPress 中“创立数据库连接时出错”
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">!["<span style="color: black;">创立</span>数据库连接时出错" |解释及<span style="color: black;">处理</span><span style="color: black;">办法</span>]"Error establishing a database connection" | Explanation & solution")</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">内容管理系统WordPress 为您<span style="color: black;">怎样</span>让您的网站在线<span style="color: black;">供给</span>了简单的选项。只需单击几下,您就<span style="color: black;">能够</span><span style="color: black;">创立</span>博客、在线商店或综合性<span style="color: black;">机构</span>网站。大<span style="color: black;">都数</span>时候一切都很顺利,<span style="color: black;">然则</span>当<span style="color: black;">显现</span>问题时,WordPress 用户<span style="color: black;">一般</span>会在<span style="color: black;">无</span>任何<span style="color: black;">帮忙</span>的<span style="color: black;">状况</span>下离开。当网站<span style="color: black;">忽然</span>关闭时,尤其令人<span style="color: black;">懊丧</span>。<span style="color: black;">咱们</span>解释了 WordPress 数据库错误“<span style="color: black;">创立</span>数据库连接错误”的含义、<span style="color: black;">出现</span>时间以及<span style="color: black;">怎样</span>修复它。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">小费</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">为了<span style="color: black;">认识</span> WordPress 经常<span style="color: black;">运用</span>的术语,<span style="color: black;">咱们</span>整理了一份的 10 个最<span style="color: black;">要紧</span>的 WordPress 术语的列表。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">![数据库报错“<span style="color: black;">创立</span>数据库连接时出错”截图]("Screenshot of the database error "Error establishing a database connection"")</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">WordPress:“<span style="color: black;">创立</span>数据库连接时出错”——<span style="color: black;">此刻</span><span style="color: black;">无</span>任何效果</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">错误信息是什么意思?</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">WordPress 网站<span style="color: black;">重点</span>基于数据库,而数据库又<span style="color: black;">运用</span> <strong style="color: blue;">MySQL 数据库管理系统</strong>。当互联网用户浏览您的 WordPress 站点时,PHP 命令会请求所需的数据库条目。<span style="color: black;">然则</span>,<span style="color: black;">倘若</span>用户只能看到“<span style="color: black;">创立</span>数据库连接时出错”<span style="color: black;">信息</span>,则此数据库信息请求<span style="color: black;">没</span>效。不幸的是,错误<span style="color: black;">信息</span><span style="color: black;">无</span>揭示 WordPress <span style="color: black;">没</span>法连接到数据库的<span style="color: black;">原由</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">WordPress什么时候<span style="color: black;">显现</span>“<span style="color: black;">创立</span>数据库连接时出错”?</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">错误<span style="color: black;">信息</span>不<span style="color: black;">必定</span><span style="color: black;">是由于</span>您所做的事情触发的。在大<span style="color: black;">都数</span><span style="color: black;">状况</span>下,这是<span style="color: black;">因为</span>未正确存储数据库的登录数据或数据库本身已损坏。这可能是<span style="color: black;">因为</span>插件在您不<span style="color: black;">干涉</span>或不知情的<span style="color: black;">状况</span>下进行更改。错误的另一个<span style="color: black;">原由</span>可能是<strong style="color: blue;">数据库服务器</strong>本身。<span style="color: black;">因此呢</span>,纠正错误的<span style="color: black;">第1</span>步是找到错误的确切<span style="color: black;">源自</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">怎样</span>修复WordPress数据库错误?</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">故障排除的一个很好的起点是尝试登录后端。尝试<span style="color: black;">拜访</span> wp-admin <span style="color: black;">亦</span>可能不起<span style="color: black;">功效</span>,但浏览器可能会<span style="color: black;">表示</span>另一条<span style="color: black;">信息</span>:“一个或多个数据库表不可用。数据库可能<span style="color: black;">必须</span>修复”。<span style="color: black;">倘若</span><span style="color: black;">显现</span>这个错误,问题就很清楚了:数据库有错误<span style="color: black;">引起</span><span style="color: black;">全部</span>系统瘫痪。幸运的是,WordPress 有一个内置的<strong style="color: blue;">修复功能</strong>,您<span style="color: black;">必要</span><span style="color: black;">经过</span> wp-config.php 手动<span style="color: black;">起步</span> - 此时您<span style="color: black;">没</span>法<span style="color: black;">拜访</span>后端。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="//q6.itc.cn/images01/20240625/a5090cd2726d437e8506f96a86d2af3d.jpeg" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">经过</span>在 wp-config.php 文件中<span style="color: black;">插进</span>一行代码,<span style="color: black;">就可</span>激活数据库修复<span style="color: black;">工具</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">要<span style="color: black;">拜访</span> <strong style="color: blue;">wp-config.php</strong>,您<span style="color: black;">必须</span>与您的服务器<span style="color: black;">创立</span> FTP 连接。最简单的<span style="color: black;">办法</span>是<span style="color: black;">运用</span>诸如FileZilla或另一个FTP 程序之类的软件。<span style="color: black;">倘若</span>您已<span style="color: black;">创立</span>与服务器的连接(<span style="color: black;">拜访</span>数据<span style="color: black;">一般</span>由您的托管服务<span style="color: black;">供给</span>商<span style="color: black;">供给</span>),您应该在网站的根目录中找到所需的文件。下载它并<span style="color: black;">运用</span>文本编辑器打开它。配置文件<span style="color: black;">包括</span>数据库的设置。要激活修复<span style="color: black;">工具</span>,请在 MySQL 设置后面<span style="color: black;">插进</span>一行代码:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">define( WP_ALLOW_REPAIR, true );</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">保证</span><span style="color: black;">运用</span><strong style="color: blue;">正确的语法</strong>:正确的引号和空格<span style="color: black;">位置于</span>正确的位置至关<span style="color: black;">要紧</span>。<span style="color: black;">保留</span>文件并将其上传回您的服务器。<span style="color: black;">经过</span><span style="color: black;">这般</span>做,您将覆盖原始文件。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">笔记</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在对 WordPress 文件进行任何更改之前,<span style="color: black;">意见</span>进行备份。除了 WordPress 数据库错误之外,不正确的条目还可能<span style="color: black;">引起</span>其他问题。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">上传完成后,您<span style="color: black;">必须</span><span style="color: black;">拜访</span>以下页面:http://域名/wp-admin/maint/repair.php(请输入您自己的域)。在<span style="color: black;">此刻</span>激活的<span style="color: black;">工具</span>中,您<span style="color: black;">能够</span><strong style="color: blue;">修复数据库</strong><span style="color: black;">乃至</span>优化它。修复完成后,您应该再次停用该<span style="color: black;">工具</span>,以便第三方<span style="color: black;">没</span>法<span style="color: black;">拜访</span>它,<span style="color: black;">由于</span><span style="color: black;">每一个</span>人都<span style="color: black;">能够</span><span style="color: black;">拜访</span>修复 URL。<span style="color: black;">因此呢</span>,再次打开 wp-config.php 并将命令中的值从 true 更改为 false <span style="color: black;">或</span>干脆删除整行。不要忘记<span style="color: black;">保留</span>修改后的文件并将其上传回您的服务器。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="//q8.itc.cn/images01/20240625/27a45097cc5e4a908776020facd4a284.jpeg" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">激活后,您<span style="color: black;">能够</span>在浏览器中<span style="color: black;">拜访</span>有用的 WordPress <span style="color: black;">工具</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">然则</span>,<span style="color: black;">倘若</span>后端<span style="color: black;">亦</span><span style="color: black;">表示</span>错误<span style="color: black;">信息</span>“<span style="color: black;">创立</span>数据库连接时出错”怎么办?这可能是<span style="color: black;">因为</span><strong style="color: blue;">数据库的登录数据不正确</strong>。您<span style="color: black;">能够</span>在同一个文件 (wp-config.php) 中<span style="color: black;">检测</span>这些内容。在源代码的开头,您将找到<span style="color: black;">包括</span>数据库名<span style="color: black;">叫作</span>、用户名、<span style="color: black;">暗码</span>和主机名的相应行。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">// ** MySQL settings ** //</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/** The name of the WordPress database */</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">define( DB_NAMEhttp://www.lxnjj.cnThe name of your database );</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/** MySQL database username */</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">define( http://www.jj-999.cn, Your username );</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/** MySQL database password */</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">define( http://www.sshualian.com.cn, Your password );</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/** MySQL hostname */</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">define( DB_HOST, The name of your database host );</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">检测</span>此数据<span style="color: black;">是不是</span>正确。您<span style="color: black;">能够</span>从您的托管服务<span style="color: black;">供给</span>商处获取登录信息(您<span style="color: black;">一般</span><span style="color: black;">能够</span>在您的<span style="color: black;">供给</span>商的计算机配置文件中在线查看登录数据)。<span style="color: black;">保证</span>此时语法<span style="color: black;">亦</span>是正确的。主机名取决于您的<span style="color: black;">供给</span>商。 WordPress 在其 codex 中<span style="color: black;">供给</span>了一个DB_HOST 值列表。找到错误<span style="color: black;">出现</span>的位置后,只需更正相应的值并<strong style="color: blue;">将正确的版本上传到您的服务器</strong>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">顺便说一句,<span style="color: black;">倘若</span>问题在<strong style="color: blue;">新安装后立即<span style="color: black;">显现</span></strong>时,<span style="color: black;">一样</span>的<span style="color: black;">处理</span><span style="color: black;">方法</span><span style="color: black;">亦</span>有效。您可能在安装窗口中输入了错误的用户数据。您<span style="color: black;">能够</span>直接编辑_wp-config.php_,而不是重新<span style="color: black;">起始</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span>这<span style="color: black;">亦</span><span style="color: black;">不可</span><span style="color: black;">处理</span>问题,则可能是您的数据库或登录数据<span style="color: black;">无</span>问题。相反,托管您的数据库的<strong style="color: blue;">服务器</strong>可能遇到了问题,并触发了 WordPress 的“<span style="color: black;">创立</span>数据库连接错误”错误。这可能有两个<span style="color: black;">原由</span>:<span style="color: black;">全部</span>服务器当前已关闭或<span style="color: black;">最少</span>暂时因<span style="color: black;">太多</span>的流量而过载。在后一种<span style="color: black;">状况</span>下,问题会在几分钟内<span style="color: black;">自动</span><span style="color: black;">处理</span>。<span style="color: black;">倘若</span>像<span style="color: black;">这般</span>的过载经常<span style="color: black;">出现</span>,您应该<span style="color: black;">思虑</span>与您的托管服务<span style="color: black;">供给</span>商<span style="color: black;">一块</span>寻找更好的<span style="color: black;">处理</span><span style="color: black;">方法</span>。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">事实</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">您的 WordPress 网站的文件(<span style="color: black;">包含</span> PHP 和 CSS)和数据库的文件很可能不在同一台服务器上。这<span style="color: black;">寓意</span>着虽然您的网站<span style="color: black;">能够</span><span style="color: black;">经过</span>“<span style="color: black;">创立</span>数据库连接时出错”来<span style="color: black;">拜访</span>,但它<span style="color: black;">再也不</span>连接到数据库并且<span style="color: black;">没</span>法<span style="color: black;">表示</span>任何内容。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span><strong style="color: blue;">服务器完全关闭</strong>,您还<span style="color: black;">必要</span>联系您的托管服务<span style="color: black;">供给</span>商。<span style="color: black;">倘若</span>您不是自己托管数据库,则<span style="color: black;">没</span>法<span style="color: black;">自动</span><span style="color: black;">处理</span>此问题——在这种<span style="color: black;">状况</span>下,您的<span style="color: black;">供给</span>商的 IT 专家将不得不处理该问题。在与您的<span style="color: black;">供给</span>商联系之前,您<span style="color: black;">能够</span>自己<span style="color: black;">检测</span>服务器<span style="color: black;">是不是</span>可能<span style="color: black;">再也不</span><span style="color: black;">能够</span><span style="color: black;">拜访</span>。为此,请尝试查看您<span style="color: black;">是不是</span><span style="color: black;">能够</span><span style="color: black;">经过</span>托管服务<span style="color: black;">供给</span>商的用户区域<span style="color: black;">拜访</span><strong style="color: blue;">phpMyAdmin</strong>(用于管理数据库的 Web 界面)。<span style="color: black;">倘若</span><span style="color: black;">没</span>法<span style="color: black;">创立</span>连接,则错误不是您的责任。<a style="color: black;"><span style="color: black;">返回<span style="color: black;">外链论坛:www.fok120.com</span>,查看<span style="color: black;">更加多</span></span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">责任编辑:网友投稿</span></p>
楼主继续加油啊!外链论坛加油! 你的见解真是独到,让我受益良多。 回顾历史,我们不难发现:无数先辈用鲜血和生命铺就了中华民族复兴的康庄大道。
页:
[1]