How to Fix “Event Scheduler System Tables Damaged” Error During MySQL Database Migration


2 views

During a recent database migration project between MySQL servers, I hit this annoying roadblock when using Navicat:

Cannot proceed because system tables used by Event Scheduler were found damaged at server start

The transfer kept failing despite having run mysql_upgrade successfully on the source server (a WampServer environment). Here's what actually worked.

After wasting hours trying various fixes, the solution was embarrassingly simple:

# On Windows (using WampServer):
net stop mysql
net start mysql

# On Linux:
sudo systemctl restart mysql

Yes - just a MySQL service restart after running mysql_upgrade. Apparently the upgrade doesn't automatically reload the affected system tables.

The Event Scheduler system tables (mysql.event, mysql.time_zone etc.) can become corrupted during:

  • Improper server shutdowns
  • Version upgrades without proper maintenance
  • Direct table manipulation (never edit these manually!)

For cases where a simple restart doesn't work, here's the complete repair sequence:

# 1. First run the upgrade
mysql_upgrade -u root -p --force

# 2. Then check and repair tables
mysqlcheck -u root -p --all-databases --check-upgrade --auto-repair

# 3. Finally restart the service
sudo systemctl restart mysql  # or equivalent for your OS

Here's a bash script I now run before any migration:

#!/bin/bash
# MySQL maintenance pre-migration checklist

MYSQL_USER="admin"
MYSQL_PASS="securepassword"

echo "[1] Running mysql_upgrade..."
mysql_upgrade -u $MYSQL_USER -p$MYSQL_PASS --force

echo "[2] Verifying system tables..."
mysqlcheck -u $MYSQL_USER -p$MYSQL_PASS --all-databases --check-upgrade --auto-repair

echo "[3] Restarting MySQL service..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
    sudo systemctl restart mysql
elif [[ "$OSTYPE" == "darwin"* ]]; then
    brew services restart mysql
elif [[ "$OSTYPE" == "msys"* ]]; then
    net stop mysql && net start mysql
fi

echo "[4] Verifying Event Scheduler status..."
mysql -u $MYSQL_USER -p$MYSQL_PASS -e "SHOW VARIABLES LIKE 'event_scheduler';"

If you're still having issues, these methods bypass the Event Scheduler entirely:

# Using mysqldump with --skip-events flag
mysqldump -u root -p --skip-events --databases your_db > backup.sql

# Using mysqlpump (MySQL 5.7+)
mysqlpump -u root -p --skip-events --databases your_db > backup.sql

After fixing, always verify with:

SELECT * FROM mysql.event;  # Should return empty or valid records
SHOW VARIABLES LIKE 'event_scheduler%';

While attempting to migrate data between MySQL servers using Navicat, I encountered this frustrating error:

Cannot proceed because system tables used by Event Scheduler were found damaged at server start

The error occurred despite having run mysql_upgrade successfully. Here's what I discovered about this issue and how to properly resolve it.

This error typically appears when MySQL's internal system tables related to the Event Scheduler become corrupted. Common scenarios include:

  • Improper server shutdown
  • Disk write errors during operation
  • Version upgrade inconsistencies
  • File permission issues

After trying several approaches, here's the definitive fix sequence:

  1. First, run the upgrade utility:
  2. mysql_upgrade --force -u root -p
  3. Then, the critical step many miss - restart MySQL:
  4. # On Linux systems
    sudo systemctl restart mysql
    
    # On Windows (via command prompt)
    net stop mysql
    net start mysql

To confirm the Event Scheduler is functioning properly:

SHOW VARIABLES LIKE 'event_scheduler';
SELECT * FROM mysql.event;

You should see the scheduler enabled and any existing events listed without errors.

To avoid this issue during future migrations:

  • Always stop the Event Scheduler before shutdown:
  • SET GLOBAL event_scheduler = OFF;
  • Regularly check table integrity:
  • CHECK TABLE mysql.event;
    REPAIR TABLE mysql.event;

If you continue experiencing issues, consider these alternative methods:

# Using mysqldump
mysqldump -u username -p database_name > backup.sql
mysql -u username -p new_database < backup.sql

# Using MySQL Workbench's migration wizard
# (Provides more robust error handling)

For persistent corruption cases, you may need to:

  1. Backup your data
  2. Reinitialize the system tables:
  3. mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
  4. Restore your data