How To Fix WordPress Database Connection Error
If you are seeing this error above when going to your website for WordPress, you probably have a database connection string issue. Database connection strings are found within the wp-config file. You will need to update them to the correct username and password as well as the database name. *note wp-config is found in your WordPress root directory
Reasons for seeing database error
If you have recently migrated your WordPress site, created a new database with new username, password, database name or change WordPress table prefix. Then you will need to update your connection strings found within the wp-config file of WordPress. You may have to update the username and password through MySql within side your hosting account.Below is link how to change, find and edit your connection strings.
Changing Database table prix
- Frist find the table prix with in phpmyadmin (usually wp_ by default)
- Copy it
- Replace the table prefix from within the wp-config file
- Table prefix looks like this ( $table_prefix = ‘wp_’; )
- Replace what you see in phpmyadmin between the two single quotes ‘ ‘ within the wp-config see link above.
Database Find And Replace Prefix
You can also do a Database find and replace by downloading your Database and using notepad ++ to find all and replace all.
- Open Notepad++, click file and open
- Find database in downloads and open in Notepad++
- Hold Ctrl-f and that will load the find table and replace screen
- Click Replace tab
- type in what you want to find and what you want to replace with
- See screen shot below