The WP Tools plugin (version 2.41 or bigger) can enables you to optimize and repair InnoDB and MyISAM database tables. It uses WordPress built-in database optimization tools to get the job done. This can help to fix “Error establishing database connection” message.
Maintaining a well-optimized database helps to improve site performance.
To use this tool, you can’t be this line on your file wp-config.php:
WP_ALLOW_REPAIR = false