cd /news/developer-tools/repair-mysql-data-directory-for-xamp… · home topics developer-tools article
[ARTICLE · art-10402] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Repair MySQL data directory (for XAMPP)

This article provides a PowerShell script to repair the MySQL data directory in XAMPP by backing up the existing data folder, creating a new one from a backup, and then selectively copying user databases and the essential `ibdata1` file from the old directory. The script excludes system databases like `mysql`, `performance_schema`, and `phpmyadmin` during the recovery process. After completion, it notifies the user that the repair is finished and that the previous data is stored in a folder named `data_old`.

read1 min views24 publishedAug 28, 2020
repair-mysql-data.ps1

      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

Learn more about bidirectional Unicode characters

Show hidden characters
Rename-Item -Path "./data" -NewName "./data_old"


Copy-Item -Path "./backup" -Destination "./data" -Recurse

Remove-Item "./data/test" -Recurse

$dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory

Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse

Copy-Item -Path "./data_old/ibdata1" -Destination "./data/ibdata1"

Write-Host "Finished repairing MySQL data"

Write-Host "Previous data is located at ./data_old"

── more in #developer-tools 4 stories · sorted by recency
── more on @xampp 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/repair-mysql-data-di…] indexed:0 read:1min 2020-08-28 ·