Brazil's biggest MU Online portal — since 2003
Tutorial Advanced Admin

How to Fix a Corrupted Database Error on Your MU Online Server

Diagnose corrupted tables in your MU Online server's MySQL/MariaDB, safely recover character and item data, and implement a backup routine to prevent permanent progress loss.

RO Rodrigo · Updated on Oct 19, 2017 · ⏱ 16 min read
Quick answer

Few incidents scare a MU Online server administrator more than opening the GameServer in the morning and finding corrupted table errors in the database — with the real risk of losing characters, items, and player progress. The good news is that most corruption cases are recoverable, fully or partial

Few incidents scare a MU Online server administrator more than opening the GameServer in the morning and finding corrupted table errors in the database — with the real risk of losing characters, items, and player progress. The good news is that most corruption cases are recoverable, fully or partially, as long as diagnosis and correction follow a careful order that doesn't make the damage worse. This tutorial covers the complete process: identifying the type and extent of the corruption, recovering as much data as possible, restoring from backup when necessary, and implementing a routine that drastically reduces the risk of this happening again.

Recognizing the symptoms of corruption

The most common signs of database corruption on a MU server include: the GameServer failing to start with an error related to a specific table (Character, Warehouse, AccountCharacter), simple SQL queries returning a Table 'X' is marked as crashed error, characters or items disappearing or appearing duplicated, and MySQL itself logging I/O or corrupted index errors in the log (mysqld.log or Event Viewer on Windows).

First action: stop writing to the database

Before any diagnosis, stop the GameServer and any other process that writes to the database (JoinServer, web panel, admin tools). Continuing to operate on a corrupted database increases the risk of the corruption spreading to other tables or overwriting data that might still be recoverable. Make a raw copy of MySQL's data files (the data/ directory, usually at /var/lib/mysql on Linux or C:\ProgramData\MySQL\MySQL Server X.X\Data on Windows) before attempting any repair — this copy is your safety net in case the repair makes things worse.

Identifying the storage engine of the affected tables

SELECT TABLE_NAME, ENGINE 
FROM information_schema.TABLES 
WHERE TABLE_SCHEMA = 'MuOnline';

The recovery procedure changes depending on the engine:

EngineVulnerability to corruptionMain repair tool
MyISAMHigh (no journaling, sensitive to abrupt shutdown)myisamchk, REPAIR TABLE
InnoDBLow (redo log recovers automatically in most cases)innodb_force_recovery, dump and reimport
Aria (MariaDB)Mediumaria_chk, REPAIR TABLE

Repairing corrupted MyISAM tables

With MySQL stopped, use myisamchk directly on the files:

sudo systemctl stop mysql

cd /var/lib/mysql/MuOnline
myisamchk -r Character.MYI
myisamchk -r Warehouse.MYI

sudo systemctl start mysql

The -r (recover) flag tries to rebuild the index and recover as many rows as possible. If myisamchk reports it couldn't fully recover, try the more aggressive -o (safe recover) flag, which is slower but more careful during reconstruction.

Alternatively, with MySQL running, you can use the equivalent SQL command:

CHECK TABLE Character;
REPAIR TABLE Character;

Recovering InnoDB with force_recovery

If InnoDB doesn't start normally after a corruption, add the forced recovery directive to my.cnf/my.ini, starting with the mildest level:

[mysqld]
innodb_force_recovery = 1

Bring the service up, run a full database dump (mysqldump) while still in recovery mode, and restore that dump into a new, clean MySQL instance. Never run production with innodb_force_recovery enabled for long — this mode disables internal protections and exists only to allow safe data extraction before recreating the database from scratch.

mysqldump -u root -p --single-transaction MuOnline > recovery_dump.sql

# Then, on a new/clean instance:
mysql -u root -p MuOnline < recovery_dump.sql

If level 1 isn't enough for the dump to complete, gradually increase it up to level 4 or 6 (the higher levels are more destructive and should be the last resort, since they skip increasingly fundamental integrity checks).

Restoring from backup when the repair fails

If a direct repair doesn't reliably recover the data, restoring the last valid backup is the safest path:

# Restore full backup
mysql -u root -p MuOnline < backup_2026-07-28.sql

Before restoring, compare the backup's timestamp with the estimated time of the corruption — if the backup is several hours or days older than the incident, consider whether it's worth manually recovering the differences (character creation records, recent drops) from GameServer logs, if your emulator keeps that kind of audit log.

Verifying integrity after recovery

After repairing or restoring, run basic checks before releasing the server to players:

CHECK TABLE Character, Warehouse, AccountCharacter, Guild;
SELECT COUNT(*) FROM Character;
SELECT COUNT(*) FROM Warehouse;

Compare the counts against what you'd expect based on the number of active players — an abrupt, unexplained drop in row count is a sign the recovery wasn't complete.

Investigating the root cause

Fixing the corruption without understanding the cause is treating the symptom, not the problem. The most common causes are: power loss or abrupt machine shutdown, a kill -9 on the MySQL process instead of a graceful shutdown, a disk with bad sectors, and running out of disk space during a write. Check the operating system and MySQL logs (mysqld.log) around the time of the corruption to identify which of these scenarios occurred.

# Check disk health (Linux)
sudo smartctl -a /dev/sda

# Check available disk space
df -h

Implementing a backup routine to prevent recurrence

Backup typeRecommended frequencyRetention
Full logical dump (mysqldump)Daily7 to 14 days
Physical backup (data directory copy, service stopped)Weekly4 weeks
Incremental backup (binlog)ContinuousUntil the next full dump

Automate the daily dump with a cron job (Linux) or Task Scheduler (Windows), writing the files to a location outside the server machine itself (another disk, another server, or cloud storage), so a hardware failure doesn't simultaneously destroy the database and the backups.

# Example of a daily cron job at 4 AM
0 4 * * * mysqldump -u root -ppassword MuOnline | gzip > /backup/mu_$(date +\%F).sql.gz

Common errors and fixes

SymptomLikely causeFix
GameServer won't start, crashed table errorCorrupted MyISAM tableRun myisamchk -r or REPAIR TABLE with the service stopped
InnoDB won't come up at allCorruption in the tablespace or redo logUse incremental innodb_force_recovery and dump to reinstall clean
Characters/items disappeared after the corruptionIncomplete repair or unrecoverable dataRestore from the last valid backup and compare row counts
Corruption keeps happening periodicallyRoot cause not identified (disk, power, process)Check disk SMART status and how MySQL is being shut down
Most recent backup is also corruptedBackup taken during the corruption, without prior verificationValidate dump/backup integrity before overwriting previous versions

Corrupted database recovery checklist

  • GameServer and other processes stopped before any action.
  • Raw copy of the data files made before the repair.
  • Storage engine identified (MyISAM, InnoDB, Aria).
  • Repair attempted with the tool appropriate to the engine.
  • Backup restore performed if the repair wasn't sufficient.
  • Integrity verified (row counts, CHECK TABLE) before releasing the server.
  • Root cause investigated (disk, power, abrupt shutdown).
  • Automated backup routine stored outside the main machine.

With the database recovered and a backup routine in place, it's worth reviewing the entire server infrastructure to reduce other failure points before they become incidents. Check out the MU Online server creation tutorial to review the complete fundamentals of your environment's setup.

Frequently asked questions

Is it possible to recover 100% of the data from a corrupted table without a backup?

Most of the time, no. Tools like myisamchk/mysqlcheck can recover a significant portion of data in corrupted MyISAM tables, but records inside damaged blocks are usually lost permanently. Regular backups are the only real guarantee against total loss.

Does InnoDB get corrupted as often as MyISAM?

No. InnoDB has journaling (redo log) that protects against most corruption caused by power outages or abrupt process termination, recovering automatically on startup. MyISAM doesn't have this mechanism, making it more vulnerable to corruption in these scenarios — which is why many MU emulators migrated critical tables to InnoDB.

How do I know if the corruption was caused by hardware (disk) or by MySQL being shut down improperly?

Run a disk health check (SMART, smartctl on Linux, or the manufacturer's utility on Windows) right after identifying the corruption. If the disk reports bad sectors or read errors, the problem is hardware-related and the corruption will likely repeat until the disk is replaced. If the disk is healthy, the most likely cause is MySQL being shut down abruptly (power loss, kill on the process, low disk space).

Can I just restore the most recent backup without investigating the cause?

That may resolve the immediate symptom, but without identifying the cause (a failing disk, low disk space, an improper service shutdown) the corruption tends to recur. Always investigate the root cause in parallel with the restore, so you don't get stuck in a cycle of recurring corruption.

Does running CHECK TABLE regularly prevent corruption?

It doesn't prevent it, but it detects problems early, before they become serious enough to take down the GameServer or cause visible loss of player progress. It's worth running CHECK TABLE periodically as part of your maintenance routine, alongside regular backups.

RO
Founder & editor-in-chief

Rodrigo has run ViciadosMU since the portal's early days. A specialist in MU Online server creation and administration, game history and the evolution of the seasons — he wrote much of the archive before 2024.

Keep reading

Related articles