The Error

This error occurs when InnoDB tries to access a page that doesn't exist within the defined boundaries of a tablespace:

[ERROR] InnoDB: Error: trying to access page number 12345 in space 5,
space name mydb/mytable, which is outside the tablespace bounds.
Byte offset 0, len 16384, i/o type 10.

Common Causes

  • Truncated tablespace file - The .ibd file was accidentally shortened
  • Disk full during write - Incomplete writes due to lack of space
  • File system corruption - Underlying storage issues
  • Improper file copy/restore - Incomplete backup restoration
  • Index corruption - B-tree index pointing to invalid pages

Diagnosis Steps

  1. Check the actual file size vs expected size
  2. Verify disk space availability
  3. Check for filesystem errors
  4. Review MySQL error logs for additional context

Recovery Options

Option 1: Restore from Backup

If you have a recent backup, this is the safest option.

Option 2: Force Recovery Mode

[mysqld]
innodb_force_recovery = 1

Start MySQL with force_recovery and attempt to dump the data using mysqldump. Increase the value if needed (up to 6).

Option 3: DBRECOVER for MySQL

DBRECOVER can read the valid portions of a truncated or corrupted tablespace:

  1. Open the .ibd file in DBRECOVER
  2. The tool will analyze available pages
  3. Extract data from valid pages only
  4. Export recovered data

Prevention

  • Monitor disk space and set up alerts
  • Use reliable backup procedures
  • Verify backups after creation
  • Use RAID or replicated storage