error establishing a database connection

Are you still facing the issue? I might be able to help you out. Here are some more reasons why it might be happening: A corrupted database – Bad plugins, addons, themes and data-transfer interruptions might leave your database short of tables or completely corrupted at worst. Corrupted WordPress files Found this on: http://www.wpkube.com/how-to-fix-error-establishing-database-connection-in-wordpress/

Converting mysql to $wpdb

You can query INFORMATION_SCHEMA and achieve the same: function getEnumValues($table, $field) { global $wpdb; $result = $wpdb->get_row(“SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ‘” . DB_NAME . “‘ AND TABLE_NAME = ‘” . $table . “‘ AND COLUMN_NAME LIKE ‘” . $field . “‘”); if($result === FALSE) { die($wpdb->last_error); } // this is the column … Read more

Cron While Editing Post

It seems to have solved by changing the two functions, by taking a different approach: /* CHECK IF CURRENT USER IS NOT IN POST.PHP AND IN POST-NEW.PHP AND DOWNGRADE PUBLISH POSTS IN PENDING AFTER X DAYS */ if(is_admin() ) {global $pagenow; if( ‘post.php’ != $pagenow || ‘post-new.php’ != $pagenow) { add_action( ‘init’, ‘downgrade_publish_posts’ ); function … Read more

Building a Scalable Resiliant WP Setup

Scaling with hardware alone is expensive. We’ve worked with a few high traffic sites and a lot of demanding ecommerce/WooCommerce sites. The way we’ve scaled those is by testing the code, optimising database calls, optimising the database itself and implemented full page caching. Here’s a few tips to get you started Use nginx instead of … Read more

Why can’t I swap a DB in a WP install? [closed]

Reasons this might happen: When WP checks the tables exist and they don’t If the DB connection fails The database is unreachable A DESCRIBE query on the tables fails, be it permissions or access based If there is an error recorded in the wpdb object while setting up initial variables in wp_set_wpdb_vars When ms_load_current_site_and_network returns … Read more