Skip to content
Menu
DevSecOps Now!!!
  • About
  • Certifications
  • Contact
  • Courses
  • DevSecOps Consulting
  • DevSecOps Tools
  • Training
  • Tutorials
DevSecOps Now!!!

Complete Tutorial: Fixing MariaDB / MySQL Not Starting in XAMPP on Windows

Posted on January 5, 2026

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Error: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed

1. Introduction

One of the most frustrating issues developers face while working with XAMPP on Windows is when MySQL/MariaDB refuses to start, even though the logs initially look normal.

In this case, MariaDB:

  • Appears to start
  • Initializes InnoDB correctly
  • Then silently exits
  • Does not listen on port 3306
  • Shows no running mysqld process

Eventually, when started in console mode, it fails with a fatal privilege table error.

This tutorial explains:

  • How to diagnose the issue correctly
  • Why the problem happens
  • How to safely repair the MySQL system tables
  • How to verify the fix
  • What to do if repair fails

2. Initial Symptoms Observed

You experienced the following symptoms:

  • XAMPP MySQL shows โ€œStartingโ€ and then stops
  • netstat -ano | findstr :3306 shows no output
  • tasklist | findstr mysqld shows no running process
  • mysql_error.log shows only startup messages, no shutdown reason
  • MySQL is not accessible from phpMyAdmin or applications

These symptoms usually indicate MySQL is crashing after startup, not failing to start.


3. First Diagnostic Checks

3.1 Check if MySQL is listening on port 3306

Command:

netstat -ano | findstr :3306

Result:

  • No output โ†’ MySQL is not running or not bound to the port

3.2 Check if mysqld process exists

Command:

tasklist | findstr /I mysqld

Result:

  • No output โ†’ mysqld.exe is not running

This confirms MySQL is crashing or exiting.


4. Checking the MySQL Error Log

File location:

C:\xampp\mysql\data\mysql_error.log

Command used:

powershell -Command "Get-Content 'C:\xampp\mysql\data\mysql_error.log' -Tail 120"

Observation:

  • Only startup logs
  • No explicit crash reason
  • Indicates the real error is occurring before logging fully initializes

At this stage, the correct next step is to run MySQL manually in console mode.


5. Running MySQL in Console Mode (Critical Step)

This step reveals the actual root cause.

Command:

cd C:\xampp\mysql\bin
mysqld --console

Actual Error Found:

[ERROR] mysqld: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
[ERROR] Fatal error: Can't open and lock privilege tables
[ERROR] Aborting

6. Understanding the Root Cause

What is mysql\db?

  • It is a system privilege table
  • Stored inside:C:\xampp\mysql\data\mysql\
  • Controls:
    • Database access
    • User permissions
    • Host-level grants

Why this causes MySQL to stop

MariaDB cannot start without valid privilege tables.
If mysql\db is corrupted:

  • Authentication cannot initialize
  • Server aborts immediately
  • Port is never opened
  • MySQL exits silently

This is not a user database issue โ€” it is a system table corruption.


7. Recommended Fix (Safe and Correct)

Method 1: Repair System Tables Using mysqlcheck

This method is safe, non-destructive, and should always be tried first.


Step 1: Stop MySQL Completely

From XAMPP Control Panel:

  • Click Stop on MySQL

Verify:

tasklist | findstr /I mysqld

No output means it is fully stopped.


Step 2: Start MySQL Without Privilege Checks

This allows MySQL to start even if system tables are broken.

Run Command Prompt as Administrator:

cd C:\xampp\mysql\bin
mysqld --skip-grant-tables --skip-networking --console

Important notes:

  • Keep this window open
  • MySQL will appear to โ€œhangโ€ โ€” this is normal
  • Networking is disabled for safety

Step 3: Repair the MySQL System Tables

Open another Command Prompt as Administrator.

Run:

cd C:\xampp\mysql\bin
mysqlcheck -u root --repair mysql

Then optimize (recommended):

mysqlcheck -u root --optimize mysql

This repairs:

  • mysql.db
  • Other privilege-related system tables
  • Internal metadata

Step 4: Stop the Temporary Server

Go back to the first console window and press:

Ctrl + C

This safely shuts down the skip-grant MySQL instance.


Step 5: Start MySQL Normally

From XAMPP Control Panel:

  • Click Start on MySQL

Step 6: Verify MySQL Is Running

Check port:

netstat -ano | findstr :3306

Check process:

tasklist | findstr /I mysqld

If both show output, MySQL is running successfully.


8. Alternative Repair Method (Manual SQL Repair)

Use this only if mysqlcheck fails.

Step 1: Start MySQL in skip-grant mode

mysqld --skip-grant-tables --skip-networking --console

Step 2: Connect to MySQL

mysql -u root

Step 3: Run manual repairs

USE mysql;
REPAIR TABLE db;
REPAIR TABLE user;
REPAIR TABLE tables_priv;
REPAIR TABLE columns_priv;
REPAIR TABLE procs_priv;
FLUSH PRIVILEGES;
EXIT;

Stop the server (Ctrl+C) and start MySQL normally.


9. Last-Resort Recovery (Only If Repair Fails)

If tables are beyond repair:

Step 1: Backup existing system tables

C:\xampp\mysql\data\mysql  โ†’  mysql_backup

Step 2: Restore fresh system tables

  • Check if this folder exists:C:\xampp\mysql\backup\mysql
  • Copy it to:C:\xampp\mysql\data\

Step 3: Start MySQL

  • Reset users/passwords if required

This recreates a clean MySQL system schema.


10. Why This Problem Happens

Common reasons include:

  • Improper shutdown or power loss
  • Windows force restart
  • Antivirus locking .frm or .MYI files
  • Disk write interruption
  • Manual file copy inside mysql system folder

11. Prevention Tips

  • Always stop MySQL before shutting down Windows
  • Exclude C:\xampp\mysql\data from antivirus scanning
  • Avoid copying system tables between machines
  • Keep regular database backups
  • Do not manually edit files inside mysql system database

12. Final Summary

  • MySQL was not failing to start, it was crashing
  • The root cause was a corrupted privilege table
  • Running mysqld --console revealed the real error
  • Repairing system tables resolved the issue
  • No user database data needed to be deleted
Post Views: 869
  • .\mysql\db
  • .\mysql\db' is marked as crashed and last
  • Fixing MariaDB
  • MariaDB
  • MySql
Subscribe
Login
Notify of
guest
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
  • Mautic and PHP 8.3 Compatibility Guide (2026)
  • Certified AIOps Engineer: The Complete Career Path and Certification Guide
  • How to Rename Apache Virtual Host Files Safely (Step-by-Step Guide for Linux)
  • AIOps Foundation Certification: Everything You Need to Know to Get Certified
  • DevOps to Certified Site Reliability Professional: A Senior Mentorโ€™s Guide
  • Certified Site Reliability Manager Training, Preparation, and Career Mapping
  • Certified Site Reliability Architect: The Complete Career Guide
  • What Is a VPN? A Complete Beginner-to-Advanced Tutorial
  • How to Install, Secure, and Tune MySQL 8.4 on Ubuntu 24.04 for Apache Event MPM and PHP-FPM
  • Complete Guide to Certified Site Reliability Engineer Career
  • Certified DevSecOps Professional Step by Step
  • Certified DevSecOps Manager: Complete Career Guide
  • Certified DevSecOps Engineer: Skills, Career Path and Certification Guide
  • Step-by-Step: Become a Certified DevSecOps Architect
  • Tuning PHP 8.3 for Apache Event MPM and PHP-FPM on Ubuntu: A Complete Step-by-Step Production Guide
  • Complete Step-by-Step Guide to Configure Apache Event MPM, Create index.php, Set Up VirtualHost, and Fix Ubuntu Default Page
  • Convert XAMPP Apache to Event MPM + System PHP-FPM
  • The Gateway to System Observability Engineering (MOE)
  • How to Finetune Apache and Prove It Works: A Real-World Guide to Testing Performance, Concurrency, HTTP/2, Memory, CPU, and Security
  • Building a High-Performance Apache Event MPM + PHP-FPM + MariaDB Stack (Advanced Server Optimization Guide)
  • Master Infrastructure as Code: The Complete Hashicorp Terraform Associate Guide
  • Building a High-Performance Apache Server with Event MPM + PHP-FPM (Step-by-Step Guide)
  • Is XAMPP Safer for Production Than Using Apache and PHP as Root? 2026 Practical Guide
  • Unlock Cloud Security Expertise with Certified Kubernetes Security Specialist (CKS)
  • How to Fix wpDiscuz Not Replacing Default WordPress Comments in Block Themes
  • Complete Guide to Certified Kubernetes Application Developer Certification
  • Overview of Certified Kubernetes Administrator (CKA) Certification
  • How to Install and Configure XAMPP on Ubuntu 24 Server (Latest Version โ€“ 2026 Complete Guide)
  • Mastering the Google Cloud Professional DevOps Engineer
  • Mastering Azure Cloud Security: The AZ-500 Path

Recent Comments

  1. digital banking on Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)
  2. SAHIL DHINGRA on How to Uninstall Xampp from your machine when it is not visible in Control panel programs & Feature ?
  3. Abhishek on MySQL: List of Comprehensive List of approach to secure MySQL servers.
  4. Kristina on Best practices to followed in .httacess to avoid DDOS attack?
  5. Roshan Jha on Git all Commands

Archives

  • April 2026
  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022

Categories

  • Ai
  • AI Blogging
  • AiOps
  • ajax
  • Android Studio
  • Antimalware
  • Antivirus
  • Apache
  • Api
  • API Security
  • Api Testing
  • APK
  • Aws
  • Bike Rental Services
  • ChatGPT
  • Code Linting
  • Composer
  • cPanel
  • Cyber Threat Intelligence
  • Cybersecurity
  • Data Loss Prevention
  • Database
  • dataops
  • Deception Technology
  • DeepSeek
  • Devops
  • DevSecOps
  • DevTools
  • Digital Asset Management
  • Digital Certificates
  • Docker
  • Drupal
  • emulator
  • Encryption Tools
  • Endpoint Security Tools
  • Error
  • facebook
  • Firewalls
  • Flutter
  • git
  • GITHUB
  • Google Antigravity
  • Google play console
  • Google reCAPTCHA
  • Gradle
  • Guest posting
  • health and fitness
  • IDE
  • Identity and Access Management
  • Incident Response
  • Instagram
  • Intrusion Detection and Prevention Systems
  • jobs
  • Joomla
  • Keycloak
  • Laravel
  • Law News
  • Lawyer Discussion
  • Legal Advice
  • Linkedin
  • Linkedin Api
  • Linux
  • Livewire
  • Mautic
  • Medical Tourism
  • MlOps
  • MobaXterm
  • Mobile Device Management
  • Multi-Factor Authentication
  • MySql
  • Network Traffic Analysis tools
  • Paytm
  • Penetration Testing
  • php
  • PHPMyAdmin
  • Pinterest Api
  • Quora
  • SAST
  • SecOps
  • Secure File Transfer Protocol
  • Security Analytics Tools
  • Security Auditing Tools
  • Security Information and Event Management
  • Seo
  • Server Management Tools
  • Single Sign-On
  • Site Reliability Engineering
  • soft 404
  • software
  • SuiteCRM
  • SysOps
  • Threat Model
  • Twitter
  • Twitter Api
  • ubuntu
  • Uncategorized
  • Virtual Host
  • Virtual Private Networks
  • VPNs
  • Vulnerability Assessment Tools
  • Web Application Firewalls
  • Windows Processor
  • Wordpress
  • WSL (Windows Subsystem for Linux)
  • X.com
  • Xampp
  • Youtube
©2026 DevSecOps Now!!! | WordPress Theme: EcoCoded
wpDiscuz