How to Customize, Modify or Change WordPress Database Connection Error Page如何自订,修改或改变的WordPress数据库连接错误页
When何时 WordPress在WordPress , a popular blog publishing platform built in PHP and uses MySQL database, cannot connect or having problem connecting to the database (such as when database is down), or the MySQL server has too many connections exceeding maximum connection allowed (especially when your post or article is been dugg on Digg.com) and rejects or denies new incoming connections, WordPress will display a default “error establishing database connection” error message page.一个流行的博客发布平台建于PHP和使用MySQL数据库,无法连接或有问题,连接数据库(例如当数据库) ,或MySQL服务器有太多的联系,超过最大允许连接(尤其是当您的帖子或文章是被dugg对digg.com ) ,拒绝或拒绝新的传入的连接,在WordPress会显示一个默认的“错误建立的数据库连接”的错误讯息页。 However, the WordPress error page, some is shown below, is not visitor friendly or user friendly, and worse, the default database error page also reveals the SQL server address and name.然而,在WordPress的错误网页,有些是如下图所示,是不是访问者的友好或用户友好,更糟的是,默认数据库的错误网页,也揭示了SQL Server的地址和名称。
Can’t select database不能选择数据库
We were able to connect to the database server (which means your username and password is okay) but not able to select the localhost database.我们可以连接到数据库服务器(即您的用户名和密码是好的) ,但无法选择本地数据库。
* Are you sure it exists? *您确定是否存在?
* On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. *在某些系统上的名称,您的数据库是前缀与您的用户名,所以会想username_wordpress 。 Could that be the problem?可这样的问题呢?If you don’t know how to setup a database you should contact your host.如果您不知道如何安装一个数据库,您应该联系您的主机。 If all else fails you may find help at the WordPress Support Forums.如果这些方法都失败,你可能会发现帮助在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 localhost.这意味着,无论用户名和密码的信息在您的可湿性粉剂- config.php文件是不正确或我们不能接触数据库服务器在本地。 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?您确定该数据库服务器正在运行?
These default Wordpress database error pages are more meant for website administrators or webmasters rather than the public visitors.这些默认的WordPress数据库错误的页面更意味着网站管理员或网站管理员,而非市民参观。 However, you can change the error page to another different error page by modifying or altering wordings and text in the error page by customizing the wp-db.php file located in wp-include directory.不过,您可以变更错误页到另一个不同的错误网页通过修改或改变措辞和案文中的错误网页通过自定义可湿性粉剂- db.php文件设在可湿性粉剂-包括目录。 Here’s how you can hack the Wordpress default error message.这里的如何,您可以入侵该WordPress所预设的错误讯息。
In wp-db.php (the file that handles the database connections that WordPress makes), you can see lines like “DB Constructor - connects to the server and selects a database” and “Select a DB (if another one needs to be selected)”.在可湿性粉剂- db.php (文件处理数据库连接的WordPress令) ,您可以看到如“分贝构造-连接到服务器,并选择一个数据库”和“选择一个分贝(如果另一项需要加以选定) “ 。 That’s where you can alter the text and word in the error page.说的,您可以改变文字和字的错误页。 Just look carefully after the line, you will see exactly the some text and message as appeared on the database error page.刚才仔细考虑后线,您会看到,正是一些文字和讯息出现在数据库错误页。 Edit them to your liking.编辑您想要的。

Beside, from line 312 onwards is the header and footer output for the HTML of database connection error page, contains inside function named “bail”, which specifies things like the title of “WordPress: Error”.旁边,从线312起是页眉和页脚输出的HTML数据库连接错误页,里面包含的功能命名为“保释” ,其中订明的东西,像“称号的WordPress :错误” 。 The “bail” function is called whenever a database connection error is encountered, and does what it’s name said - bails out the error and displays an error message instead to notify the users. “保释”功能是所谓每当一个数据库连接错误是遇到的,和做什么,它的名字所说的话-b ails出错误,并显示错误讯息,而是要通知用户。 You can change them if you like too.您可以改变他们如果你喜欢太。
Please take a backup of wp-db.php file before you customize or alter it.请采取的备份可湿性粉剂- db.php文件之前,您可以自定义或改变它。 If you break the code, your website visitors and surfers will get the PHP error instead.如果您打破代码,您的网站访问者和冲浪者将获得PHP的错误信息。 Beside, be careful that when you upgrade your WordPress.旁边,小心,当您升级您的WordPress 。 If you overwrite all files when upgrade the WordPress, the wp-db.php will be replaced back with the original unchanged version too, and you have to edit the file again.如果您覆盖所有文件时,提升的WordPress ,可湿性粉剂- db.php将取代回到与原来的版本不变,也和你必须编辑该文件再次。 Else, backup the wp-db.php before upgrading your WordPress and restore it after upgrading is done.否则,备份可湿性粉剂- db.php升级前您的WordPress和恢复它升级后是这样做。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 . 。
Related Articles相关文章
- Using PHP-MySQL Persistent Connections to Run WordPress Blog使用PHP - MySQL的持久连接运行的WordPress所博客
- How to Change the Frequency or Interval WordPress Auto Saves An Editing Post or Page如何改变频率或间隔的WordPress自动保存编辑的职位或网页
- WordPress MySQL SQL Query Error in WPDB Class在WordPress MySQL的SQL查询错误在wpdb级
- How to Move WordPress Blog to New Domain or Location如何移动的WordPress所博客新的网域或位置
- PHP Allowed Memory Size Exchausted Fatal Error PHP的允许内存大小exchausted致命错误
- Disable and Turn Off Post Revisions Tracking in WordPress 2.6 or Above禁用和关闭后的修改,跟踪在WordPress 2.6或以上
- WordPress Charset Encoding Problem After Upgrading to Version 2.2在WordPress字符的编码问题后,升级到2.2版
- Incorporate and Integrate Amazon aStore with Wordpress Page纳入和整合亚马逊astore与在WordPress页
- Paginating or Split WordPress Post or Page with NextPage in WordPress Not Working paginating或分裂的WordPress邮寄或网页下一页在WordPress没有工作
- WordPress 2.1.1 Critical Security Alert - Download Upgrade to 2.1.2在WordPress 2.1.1关键的安全警戒-下载升级到2 .1.2















