Created
April 30, 2025 16:11
-
-
Save lazuee/26c1a2b186845a4f682eeb4cb5ded11e to your computer and use it in GitHub Desktop.
xampp mysql repair
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
@echo off | |
REM Change directory to the MySQL directory | |
cd /d "C:\xampp\mysql" | |
REM Backup old data | |
rename "data" "data_old" | |
REM Create new data directory | |
xcopy "backup" "data" /E /I | |
rmdir /S /Q "data\test" | |
REM Copy directories excluding specific ones (mysql, performance_schema, phpmyadmin) | |
for /d %%i in (data_old\*) do ( | |
if /i not "%%~nxi"=="mysql" ( | |
if /i not "%%~nxi"=="performance_schema" ( | |
if /i not "%%~nxi"=="phpmyadmin" ( | |
xcopy "%%i" "data\%%~nxi" /E /I | |
) | |
) | |
) | |
) | |
REM Copy ibdata1 file | |
copy "data_old\ibdata1" "data\ibdata1" | |
REM Notify user | |
echo Finished repairing MySQL data | |
echo Previous data is located at .\data_old | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment