While browsing the website you may get an error as” Database Connection Error”. You can solve this issue using few simple steps as mentioned below.
Step 1: Login to the cPanel and click on File Manager.
Step 2: Click on Public_html folder (root document folder of the domain) and open the wp-config.php .
Step 3: Check which database is used by the website and copy the username and password of database.
Step 4: Now go to Mysql Databases. Then remove the database username and recreate the database username as specified in the wp-config.php and assign it to the database.
Step 5: If this did not resolve the issue, then check if the database is corrupted by clicking on the check DB in the MySQL databases in cPanel.
Step 6: If the database is corrupted then click on repair Database in the Mysql databases in cPanel.
Or you can also run the command: myisamchk <database> <server> to repair the database.