2

Error: One or more database tables are unavailable. The database may need to be repaired.

How can i solve this problem?

wp-config.php is correct.

3 Answers 3

2

I use windows, xampp 7.1, and I get this wordpress database corruption every month. WP_ALLOW_REPAIR does nothing, wp repair just show everything ok. Nothing in debug log.

Anyways when went to phpmyadmin, I noticed wp_options table is unopenable and phpmyadmin adviced to repair it.

I repaired table using sql command -

repair table newdb28.wp_options use_frm;

use_frm is something that tells db to ignore index and recreate db by data only.

I could click and see data in wp_options but wordpress was still not working ..

I went to xampp to xampp7.1\mysql\bin\mysqlcheck in commandline (comandline runned as administrator) and run command to repair all tables in my database

mysqlcheck dbname -uroot --auto-repair --use-frm

That checked all tables to OK, but as you can guess wp still didnt worked.

Solution : I went to wp_options table , ordered by id, and noticed lowest id is 7. Then checked my other wp project and saw that rows here start with id 3, and that keys of 7+ are identical to my broken database .. so I exported those id 3-6 rows and imported them to other table and everything miraclously work ... (those missing lines in wp_options were nobrainer copy paste stuff, but first one was 'siteurl' which I set acordingly, if you have older or develop version of same project will easier it up).

Also checked my corupted db from month ago which I didnt delete for some reason, and it had same problem missing first 5 rows in wp_options table ...

Anyways if this help anyone in future was worth a fuss :)

Sign up to request clarification or add additional context in comments.

Comments

0

I solved by adding:

define('WP_ALLOW_REPAIR', true);

Comments

0

To resolve this error, you have to add

define('WP_ALLOW_REPAIR', true);

above line in your wp-config.php file.

If this method will not work then you have to check if have a database backup then create a new database and a new user then import a backed-up database SQL file in the new database. Then replace database credentials with the old ones in your wp-config.php file.

This method will help you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.