- This topic is empty.
- AuthorPosts
-
August 31, 2020 at 6:24 am #10043
software-engineer
ParticipantError:
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.
September 1, 2020 at 2:01 am #10044tran-huy
ParticipantI solved by adding:
define('WP_ALLOW_REPAIR', true);
February 23, 2021 at 4:56 am #10045ashish-kumar
ParticipantTo 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.
June 29, 2021 at 4:57 am #10046jiro-matchonson
ParticipantI 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 🙂
- AuthorPosts
- You must be logged in to reply to this topic.