Database needs to be repaired – WordPress Installation Error
This is a very weird problem which is not very common and also not even discussed in any forum before. Here is the scenario: This problem occurs when you are installing WordPress in the local machine with the WAMP server. Below are the further steps to replicate it:
- Create a configuration file as normally we do.
- Enter the database details required for the installation.
- Hit the famous sparky installation button.
Now after a while you should expect the next step where you have to enter the admin details, but the problem starts from here only. You will get the message of
Installation failed. Database needs to be repaired
with a link to the ‘repair database’. When you will click on the link, it will again show the same message. If you start some little investigation then you will find that the installation process has not created all the tables required for the proper installation of WordPress. So here is the culprit.
This problem bugged me a lot like the solution nowhere available. I checked out everything starting from SQL logs to server logs but couldn’t find anything. So I thought that I have to repeat the installation process again with everything fresh. This time again I wasn’t so lucky but one thing I noticed that this time the number of tables created was different as that of the previous one. This was the clew.
This was the direct hint that something is causing SQL table creation threads to die i.e. server was resource-limited. Now I opened the php.ini file and changed the following settings:
Old:
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 500
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 60
New:
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 800
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 120
After changing these values the installation process went smooth. Finally, the conclusion is that the local server was resource-limited which was causing the WordPress installation error. Hope this may be helpful to someone. Feedbacks are welcome.