Debug School

rakesh kumar
rakesh kumar

Posted on

How to Fix MySQL Stopped Working After Restarting XAMPP

MySQL Not Starting After XAMPP Restart – Troubleshooting Steps
Check Port Conflicts

MySQL by default uses port 3306.

Run:

sudo netstat -tulpn | grep 3306
Enter fullscreen mode Exit fullscreen mode

If another program is using 3306, stop that service or change MySQL’s port in my.cnf.​

Review MySQL Error Logs

Error log file location:

/opt/lampp/var/mysql/<your-hostname>.err
Enter fullscreen mode Exit fullscreen mode

Look for lines mentioning “ERROR,” “InnoDB,” or “port in use.”

Check Permissions

Files in /opt/lampp/var/mysql may need correct ownership.

Set permissions with:

sudo chown -R mysql:mysql /opt/lampp/var/mysql
Enter fullscreen mode Exit fullscreen mode

Start MySQL Manually

Try:

sudo /opt/lampp/lampp startmysql
Enter fullscreen mode Exit fullscreen mode

Check Disk Space

MySQL won’t start if disk is full.

Run:

df -h
Enter fullscreen mode Exit fullscreen mode

Free up space if needed.

Look for Corrupted Tables

If log mentions corruption, move bad databases out of var/mysql and try restarting, then restore them one by one.

Check Config File (my.cnf)

Verify /opt/lampp/etc/my.cnf for syntax errors or misconfiguration.

Review SELinux/AppArmor (if enabled)

Temporarily disable SELinux/AppArmor to see if it’s blocking MySQL startup.

he error shown in the image relates to MySQL/MariaDB and appears during the initialization of tables within your XAMPP environment. The key line is:

2025-10-16 8:03:16 0 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type SET('REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE'...), found type set('REAL_AS_FLOAT', 'PIPES_AS_CONCAT', ...)
Enter fullscreen mode Exit fullscreen mode

and

Reading of mysql.event table failed. Some events may be lost or disabled.
Error occurred while initializing system tables. Disabling the Event Scheduler.
Error Explanation
The error indicates a mismatch between the expected schema definition for the mysql.event table and the actual schema present in your database. Specifically, the column sql_mode in the mysql.event table is expected to be of a certain ENUM/SET type, but your table has a different definition or order for the types.​

This commonly occurs when the MySQL/MariaDB system tables are out-of-sync with the server version, often after an upgrade, downgrade, or an incomplete installation/repair procedure

How to Resolve

Backup Your Data

Before making any corrective action, ensure to backup all important databases.

Upgrade System Tables Using mysql_upgrade

Run the mysql_upgrade command, which checks and repairs system tables to ensure compatibility with the installed server version. This is frequently the recommended fix for schema mismatches:

mysql_upgrade -u root -p
Enter fullscreen mode Exit fullscreen mode

Restart your MySQL/MariaDB server after running this command.

Review Table Definitions

You may manually compare the current definition of the mysql.event table with what is expected for your server version. For MariaDB/MySQL reference, check documentation for the schema.​

Re-initialize System Tables (Last Resort)

If the above steps fail, you might have to re-initialize the mysql system database. This is more destructive and should only be considered if other fixes do not work.

Top comments (0)