brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: WP_ALLOW_REPAIR switches on WordPress's built-in database repair page

Database
~/tips/tip-wordpress-allow-repair-maint

define( 'WP_ALLOW_REPAIR', true );

Turns on the WordPress database repair page at wp-admin/maint/repair.php, which needs no login.

If WordPress says it cannot select the database or complains about a corrupted table, there is a repair page hidden inside it. It is off by default, and for good reason.

Add this line to wp-config.php:

define( 'WP_ALLOW_REPAIR', true );

Then open https://example.com/wp-admin/maint/repair.php. The page offers to repair the database, or to repair and optimize it, and it works even when the rest of the site is broken because it does not need you to be logged in.

That last part is the caveat, and the WordPress documentation says so itself: while the constant is on, anyone who can reach that URL can start a repair. So enable it only when you need it, and remove the line as soon as the problem is solved. I would not leave it in a config file overnight.

The repair itself uses the same MySQL commands you can run by hand, so on a server where I have shell access I would first try wp db check and wp db repair. This page is for the times you only have a file manager and a browser.

Make a backup of the database before you start, even if the tables look broken. A repair does not always bring everything back.

Further reading: Editing wp-config.php, WP_ALLOW_REPAIR (WordPress Advanced Administration)

More Database tips mariadb -e 'CREATE DATABASE IF NOT EXISTS blog' mariadb-dump --no-create-info --insert-ignore shop orders > orders-rows.sql SELECT table_schema, table_name, CHECKSUM TABLE shop.orders; services: All Database tips (53) All topics

Link