Error establishing database connection occurs when WordPress is unable to retrieve data from database.This is one of the frequent error which occur when someone restore backups or try to edit database settings.Database contains data in tabular form.Information stored in WordPress database contains post,pages,comment, categories, tags, post revision etc.Without establishing connection with database one can’t access website.If WordPress fails to establish connection one may have given error.
Remove Database error in following ways :
- Log in to Cpanel
- Open MySQL
- Open public_html folder
- Search wp-config file
- Open wp-config
Edit below code with your credentials :
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
If you don’t remember values,check on MySQL database on cpanel.
Update wp-config file and open WordPress again.
Though this might be a simple logic but as a newbie,one generally faces these kind of issues,as I faced them too.
Read and Share.