Guest Posted April 22, 2015 Share Posted April 22, 2015 What causes this error? This error can occur due to a few different causes, each one is described along with recommended solution. Incorrect connection parametersBy far the most common, having incorrect connection credentials will cause the error. These credentials are located in the wp-config.php file found in the root folder for your WordPress installation. There are three credentials: database name, database user, and password. Make sure these match the information located in your cPanel. If you know the current database user password, you can reset it. If you do not know it, you will not be able to view the current password, so you will need to delete and then recreate the database user, giving it the password found in the wp-config.php file. If this is the issue, then the problem should be solved and the site should display normally Corrupted database tablesIf you have confirmed the credentials are correct and still get the error, the issue could be caused by corrupted database tables. Database tables can be checked and repaired from within the cPanel. How to check your tables Log into your cPanel Click the phpMyAdmin icon Choose the database you are working with by clicking on it in the left menu On the right side of the page, you will see a listing of your tables. Click "Check All" and then from the drop down choose "Check Table" The page will refresh and give you a summary of table that may be corrupted. As you can see from the screenshot below, all the tables are OK. If you receive any errors, you can continue reading to find how to repair your tables after checking tables in phpMyAdmin How to repair your tables Log into your cPanel Click the phpMyAdmin icon Choose the database you are working with by clicking on it in the left menu On the right side of the page, you will see a listing of your tables. Click "Check All" and then from the drop down choose "Repair Table" The page will refresh and give you a summary of the tables that were repaired. Too many concurrent database connectionsThe error can also occur if there are too many connections to your database at once. Currently, the default limit for our servers is 30 connections at once. If this is your issue, you can certainly curb it by enabling caching plugins on your website. This will limit the overall number of database interactions your Wordpress site performs. Optimizing WordPress with W3 Total Cache plugin By default WordPress is a dynamic CMS (Content Management System). This means that for every visitor request that WordPress has to process, it must first connect to the database to see if the requested page even exists. In a lot of cases this might not be problematic on a site that doesn't receive much traffic. However a sudden surge in traffic caused by search engine bots, or just a general increase in normal traffic can quickly cause your WordPress site to use up a lot of CPU resources from the server while trying to fulfill needless duplicate requests again and again. You can counter this increase in CPU usage by implementing a caching plugin. What these do is cache the first visitor's request of a new page to a plain HTML file on the server, then when another visitor comes through and requests the same page, so long as the page wasn't updated in your administration section, or updated by a comment, the cached HTML page will be served. This can greatly reduce CPU usage of your WordPress site very easily. As an example let's say you had 100 views of your front page, without caching that would require the same database query to have to run 100 times and every time it's just getting back the exact same data anyways. With a caching plugin only the first user would have the database query run to generate the cached HTML file, then the next 99 visitors would get that cached HTML served to them right away, without having to wait for any database activity to complete. This is just about always a win-win, because your visitors don't have to wait as long for your pages to load, and you're reducing the impact of WordPress's requests on the server's performance. One of the simplest WordPress caching plugins to setup is WP Super Cache which is discussed in a previous article of ours. However if you need more advanced caching options such as the ability to serve a static 404 error page the steps below will walk you through installing and configuring the W3 Total Cache plugin for WordPress. **Note: This will not work with Wordpress Multisites. Hover over Plugins in the left-hand menu, then click Add New. In the Search box, type in w3 total cache and click on Search Plugins. Under W3 Total Cache click on Install Now. Click OK in the installation pop-up. Click Activate Plugin. You should now see Plugin activated. From the left-hand menu, you should now have a new Performance section, hover over this and click on General Settings. Scroll down the general settings page ensuring that each main section is enabled. Hover over Performance again in the left-hand menu, and click on Page Cache. Ensure that these options have a checkmark beside them, then click on Save all settings: Finally to confirm that you've setup everything correctly, in your web-browser open up your site and hit (Ctrl-U), or go to View -> Page source to view the source of the page. Scroll to the very bottom of the page and you should see the W3 Total Cache banner letting you know the page has been optimized. w3tc-confirm-page-sourceOnce you've confirmed that W3 Total Cache is up and running properly on your website you're done. Now you can enjoy quicker page loads, and reduced resource usage from your WordPress site! Below #8 Page Cache Minify NOTE: If you are using minify, make sure to enable the option, save it and then immediately look at your WordPress site to make sure that the site looks normal. If you see problems with formatting, then it's possible that a theme or plugin is causing issues due to the minification. You should then disable minification and not use this option with your website. Database Cache Object Cache Browser Cache, after enabling this option click on Save all settings Below #10 Cache home page Cache feeds: site, categories, tags, comments Cache 404 (not found) pages Cache requests only for yourdomain.com hostname Don't cache pages for logged in users Optimizing WordPress with WP Super Cache PluginWP Super Cache can help optimize your WordPress website. WP Super Cache will enable your website to load faster and use less server resources. You can install WP Super Cache by first logging into your WordPress Dashboard. Once you have logged into your WordPress Dashboard, click on Plugins on the left menu pane. Then click Add New. Use the search box, and search for "super cache". After the search is finished, you can locate the plugin and click "Install Now" Once the plugin installation is complete, click on "activate Plugin" You will see a "red box" to remind you to enable WP Super Cache. click on the "Plugin Admin Page". Enable caching by clicking on the button next to "Caching On" and then click "Update Status" On the same screen as above, click on the "advanced" tab. Please select the "Use mod_rewrite to serve cache files" option and click "update status" Next you should receive this message below. Scroll down the page and you will will a large yellow box. Click on the button labeled "Update Mod_Rewrite Rules" at the bottom of the box. Once you click the box in the above screenshot it will change to green and be labeled "Mod rewrite rules updated". You have two different options to verify that WP Super Cache is installed correctly. The first way is to look at the source code of your website. The source code will show that the webpage was successfully cached. In most web browsers you can right click within the WordPress website and select "View Page Source". Look at the bottom of the page The second way to verify if super cache is working correctly and installed is checking the ,htaccess file. You can access the .htaccess file using a FTP client or through file manager in cPanel. In the same folder that contains your WordPress site, look for the .htaccess file and open it. In the .htaccess file Once you have confirmed that WP Super Cache is installed and functioning correctly, you're done! Additionally, there can be other causes for extraneous database interaction. These can be prevented by logging out of WordPress admin dashboard when not in use, disabling the WordPress autosave, and limiting or disabling WordPress revisions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.