-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunMySQLRepair.bat
More file actions
58 lines (50 loc) · 1.61 KB
/
RunMySQLRepair.bat
File metadata and controls
58 lines (50 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@echo off
:: =============================================
:: MySQL Auto Repair Launcher
:: By: Unknownplanet40 (because we learn the hard way 😅)
:: =============================================
set "SCRIPT_PATH=%~dp0MySQLRepair.ps1"
set "POWERSHELL_EXE=powershell.exe"
color 0A
title MySQL Auto Repair Launcher - By Unknownplanet40
echo [===== MySQL Auto Repair Launcher =====]
echo.
echo This will attempt to fix MySQL corruption issues safely.
echo Make sure XAMPP and MySQL are installed and closed.
echo.
echo Running with admin privileges is REQUIRED.
echo ---------------------------------------------------
echo.
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Requesting Administrator privileges...
powershell -Command "Start-Process '%~f0' -Verb RunAs"
exit /b
)
echo Select mode:
echo [1] Normal Mode
:: echo [2] WhatIf (Test only)
echo [2] Verbose (Detailed output)
:: echo [4] WhatIf + Verbose
echo [3] Backup Before Repair (Creates backup of databases)
echo [4] Exit
echo.
:: set /p mode="Enter choice (1-4): "
set /p mode="Enter choice (1, 2, 3, or 4): "
:: if "%mode%"=="2" set "PS_ARGS=-WhatIf"
if "%mode%"=="2" set "PS_ARGS=-Verbose"
:: if "%mode%"=="4" set "PS_ARGS=-WhatIf -Verbose"
if "%mode%"=="3" set "PS_ARGS=-BackupBeforeRepair -Verbose"
if "%mode%"=="4" (
echo Exiting...
exit /b
)
echo.
echo Launching PowerShell script...
echo --------------------------------------------------
%POWERSHELL_EXE% -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_PATH%" %PS_ARGS%
echo.
echo ---------------------------------------------------
echo MySQL Repair Script has finished running.
pause
exit /b