In some cases you will get an error named error establishing database connection or some irregularities in wordpress workflow. This may be due to a corrupt database. You can easily solve the corrupt database issue by wordpress inbuilt feature of database repair. You can do the following steps to repair the database and get your database working.
- You have to go into the hosting panel of your wordpress instance and go to your root directory where the files are stored.
- Open wp-config.php file and add the following flag to the file.
define ('WP_ALLOW_REPAIR', true);
3. After this when you try to access wp-admin you can see the repair database prompt. or you can go to http://your-site.com/wp-admin/maint/repair.php to get the prompt to repair database and optimise database. You can use either ones. By using repair database the database will be repaired and if repair and optmise database is clicked your wordpress database will be optimised and repaired this might also improve the performance of your wordpress website.
4. After the process is complete your problems will be resolved and site will be working again. You can remove or comment the repair flag from wp-config file if you want to.
- To repair your database using phpmyadmin you can directly go to dashboard and select the wordpress database connected to your website.
- Then select the database and at the bottom of the table you can find a dropdown box. There you can fix a repair table option select the option and you can click "go"
- This will start the repair process and after the process is done a successful message will be shown
- After this you can start accessing and using the website.