AI's answer , use it at own risk

,
How to Fix MySQL InnoDB Page Corruption (
MY-011906) after FreeBSD Update
If a FreeBSD system update causes MySQL to crash with an InnoDB insert undo log page corruption error, the database will continuously auto-crash to prevent data corruption.
The Error Log Context:
Code:
[ERROR] [MY-011906] [InnoDB] Database page corruption on disk or a failed file read of page [page id: space=4294967279, page number=290]. You may have to recover from a backup.
InnoDB: End of page dump
InnoDB: Page may be an insert undo log page
Because the corruption is located within the internal undo log tablespace rather than a standard data table, standard
REPAIR TABLE commands will not work. Here is the step-by-step process to safely isolate, extract, and restore the databases on a FreeBSD environment.
Step 1: Create a Physical Raw Backup
Before running any recovery attempts, stop the service and make a complete copy of the raw database directory to protect the remaining data files.
Bash:
# Stop the MySQL service
service mysql-server stop
# Create a safety backup copy of the data directory
cp -R /var/db/mysql /var/db/mysql_corrupted_backup
Step 2: Force Read-Only Recovery Mode
Instruct InnoDB to bypass the corrupted undo log segment so the MySQL daemon can stay online long enough to export the schemas.
1. Open the MySQL configuration file:
Bash:
ee /usr/local/etc/mysql/my.cnf
2. Add the recovery flag under the
[mysqld] section starting at level 1:
INI:
[mysqld]
innodb_force_recovery = 1
3. Attempt to start the server:
Bash:
service mysql-server start
*Note: If the server continues to crash with the same error, open my.cnf again and increment innodb_force_recovery to 2, 3, or up to 4 until the service successfully remains active.*
Step 3: Export a Clean Logical Dump
Once MySQL boots under the force recovery flag, it will operate in a strict read-only state. Immediately run a full logical export of all data.
Bash:
# Generate a complete SQL backup file
mysqldump -u root -p --all-databases --routines --triggers --single-transaction > /root/all_databases_backup.sql
Verify that the output file finishes successfully and contains data before moving to the next step.
Step 4: Wipe and Re-Initialize the MySQL Directory
To clear out the underlying corruption in the InnoDB system files, the active data directory must be entirely reset.
1. Stop the recovery instance and remove the temporary configurations:
Bash:
service mysql-server stop
ee /usr/local/etc/mysql/my.cnf
2. Remove or comment out the recovery line:
INI:
# innodb_force_recovery = 1
3. Clear the corrupted active directory and re-initialize a fresh database space:
Bash:
rm -rf /var/db/mysql/*
mysqld --initialize --user=mysql
service mysql-server start
Step 5: Import the Clean Data
With a healthy, uncorrupted database environment running, pipe the logical SQL backup file back into the system:
Bash:
mysql -u root -p < /root/all_databases_backup.sql
Once the import completes, restart the server normally. The error logs will clear, and the databases will return to full read/write functionality.