Optimize/repair database.

I have found his website was running slow and it was a bit lagging. He also told me it was showing strange errors sometimes. We both were worried. Alright, we took a long breath and we started to fix it. Question was, what was it causing those errors and what was that slowed down his website? I needed to find the right answer. We checked many things and we found they were not causing those troubles. I was not able to trust his database anymore. There are a lot of ways to fix the database in WordPress but since the database is a very sensitive thing, we needed to take extra care. So, we chose the safest method and we fixed the database with a few simple things. So, let’s see the steps that we took.

According to the WordPress documentation, it was said that I would need to add the following line to the “wp-config.php”. 

Where was that “wp-config.php” file? We started to search for it everywhere and finally, we found it in the “public_html” folder in the cPanel. 

It is the line below which we needed to add to the “wp-config.php” file. 

define( 'WP_ALLOW_REPAIR', true );

Where did I add this line in that “wp-config.php” file? I have seen the following thing at the top/beginning of that “wp-config.php”, 


and below that <?php I added that line shown above.

So, finally, it shaped like the lines below after adding that line above,


define( 'WP_ALLOW_REPAIR', true );

It meant, I added that line just under that <?php

I saved the file and then I addressed the following thing in a browser to go there.


Note: Above line says,


Please remove “forexample.com” and add the website you want to repair.

For example, I would type, 


to repair novicecamp.com. 

Yes, I got a new screen with the following image and I decided to click “Repair and Optimize Database”. 

After clicking “Repair and Optimize Database”, I have seen it did the things precisely almost immediately.

I also noticed, the WordPress documentation was strongly talking about removing that above line immediately from the “wp-config.php” after a repair/optimization, for some security reasons.  So, I removed it immediately and saved the file again.

Which line were they talking about? Was it the same line that I added to the “wp-config.php”? I have to be sure now and to be sure I see the line below which must be removed and it is the same line that I added to the “wp-config.php” file a while ago. 

define( 'WP_ALLOW_REPAIR', true );

Yes, now I see no errors, no lagging, and the website is not slow anymore. 

Are you all facing the same problem? Very strange really! So, that is the easiest fix without a plugin.

All the best.

(Please see related posts below)

4 thoughts on “Optimize/repair database.

  • April 18, 2019 at 5:18 am

    Good blog! I truly love how it is easy on my eyes and the data are well written. I’m wondering how I could be notified when a new post has been made. I’ve subscribed to your RSS feed which must do the trick! Have a great day!

  • May 29, 2019 at 1:17 pm

    You make clearer sense than the usual…


Leave a Reply

Your email address will not be published. Required fields are marked *