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

**Code:** `One or more database tables are unavailable` · **Category:** WordPress · **Seen on:** WordPress

WordPress can’t read one or more of its tables — they’re crashed (MyISAM), missing, or the table prefix in wp-config.php is wrong.

## Meaning

Server crashes and full disks corrupt MyISAM tables. Migrations with a different $table_prefix make WordPress look for wp_ tables that don’t exist.

## Common causes

- Corrupted tables after crash/disk full
- Wrong $table_prefix in wp-config.php
- Tables missing after a partial import
- Database user lacking permissions on some tables

## Quick fix

1. Check $table_prefix matches the tables
2. Repair: define('WP_ALLOW_REPAIR', true) then visit /wp-admin/maint/repair.php
3. Re-import missing tables from backup

## Detailed fix by platform

### WordPress

1. 

```php
define('WP_ALLOW_REPAIR', true);   // remove after repairing
// then open https://example.com/wp-admin/maint/repair.php
```


### Shell

1. 

```php
wp db check
wp db repair
wp db tables
```


## How to diagnose

1. **Prefix** — Tables vs $table_prefix
2. **Health** — wp db check
3. **Disk** — Free space on the DB server

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/wordpress/database-tables-unavailable-repair)
