Error Establishing a Database Connection in WordPress: Fix It
Fix “Error establishing a database connection” in WordPress: test DB credentials, reset the MySQL password, fix DB_HOST and repair tables.
💡 WordPress uses MySQL as its database management system. WordPress database is where all of the necessary website data is stored. Not just the basic information like usernames and passwords but posts, pages and comments, even the website theme and WordPress configuration settings.
Here you can find various SQL snippets and PHPMyAdmin tips.
Fix “Error establishing a database connection” in WordPress: test DB credentials, reset the MySQL password, fix DB_HOST and repair tables.
Backup plugin hangs on the database step? Find the tables that slow it down, export the database with WP-CLI and schedule it with cron.
Fix “Another update is currently in progress” in WordPress: find the core_updater.lock row, delete it safely with WP-CLI or SQL, and update.
There are several ways you can optimize the MySQL database used by your WordPress site: Optimize tables Optimize all tables in your database: OPTIMIZE TABLE wp_posts, wp_comments, wp_options, wp_usermeta, wp_term_relationships, wp_term_taxonomy, wp_termmeta; Replace wp_ with the database prefix that you are using for your WordPress installation. Repair tables Repair any damaged tables in your database: … Read full article →
After a plugin is deinstalled from a WordPress website it will either remove all its data from the database or leave it in case the plugin is installed again. Upon deactivation, if the plugin’s data isn’t removed from the database you should manually remove it in order to optimize the database and get rid of … Read full article →
wp_postmeta table should be the biggest table in your database, if not, there is a problem. Read wp_actionscheduler_actions & wp_actionscheduler_logs tables When you install WordPress for the first time, tables are created in the database, for example for the wp_postmeta table: the problem? solution: On an existing tables, We can add high-performance keys that match … Read full article →
WordPress uses the wp_commentmeta and wp_comments tables to store comments and their data. To delete all comments in WordPress simply empty those tables in the database: To delete all spam comments use: To delete all unapproved comments use: NOTE: In the above commands change wp_ prefix with the table prefix that you are using *(view … Read full article →
DO_NOT_UPGRADE_GLOBAL_TABLES is a WordPress constant that can be added to the wp-config.php file in order to avoid the upgrade functions from doing expensive queries against global tables. To enable it, simply add the following to your wp-config.php file: WordPress websites that use bbPress have large users and usermeta tables. When upgrades are running, ALTER, DELETE … Read full article →
1. log in to the MySQL: mysql -u root -p; 2. Select the database: use database_name; 3. List all users: select * from wp_users\G 4. Change the password for the user you require: UPDATE wp_users SET user_pass=MD5(‘new_password_here’) where ID=user_id_here;
According to publicwww about 5000 websites are known to be infected with this type of WordPress malware. It is similar to legendarytable.com malware and adds js code into every post and page so that visitors are redirected to third-party websites. Check if infected To check if your website is infected, open PHPMyAdmin, select your database, … Read full article →