Solution to the coexistence problem of windows mysql 5.1 and version 8.0

Origin: A certain product A uses the old version of mysql 5.1, and the amount of data is large. Product B uses the new features of mysql 8.0. You need to run A or B on a computer, so you need to make the two versions switchable as needed.

Analysis: mysql is a service program, and the server depends on the registry, so the following scheme is obtained by analyzing the registry of different versions of mysql.

1. Backup the registry of version 5.1

2. Backup the registry of version 8.0

The data files of the high version and low version of mysql are different, so they can be kept in the system disk at the same time, and the version switching of mysql can be realized by switching the registration information of the corresponding version.

5.1

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MySQL]
"DisplayName"="MySQL"
"WOW64"=dword:0000014c
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,\
  6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,\
  00,5c,00,4d,00,79,00,53,00,51,00,4c,00,5c,00,4d,00,79,00,53,00,51,00,4c,00,\
  20,00,53,00,65,00,72,00,76,00,65,00,72,00,20,00,35,00,2e,00,31,00,5c,00,62,\
  00,69,00,6e,00,5c,00,6d,00,79,00,73,00,71,00,6c,00,64,00,22,00,20,00,2d,00,\
  2d,00,64,00,65,00,66,00,61,00,75,00,6c,00,74,00,73,00,2d,00,66,00,69,00,6c,\
  00,65,00,3d,00,22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,\
  6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,\
  00,5c,00,4d,00,79,00,53,00,51,00,4c,00,5c,00,4d,00,79,00,53,00,51,00,4c,00,\
  20,00,53,00,65,00,72,00,76,00,65,00,72,00,20,00,35,00,2e,00,31,00,5c,00,6d,\
  00,79,00,2e,00,69,00,6e,00,69,00,22,00,20,00,4d,00,79,00,53,00,51,00,4c,00,\
  00,00
"ObjectName"="LocalSystem"

8.0

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\MySQL]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,\
  6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,\
  00,5c,00,4d,00,79,00,53,00,51,00,4c,00,5c,00,6d,00,79,00,73,00,71,00,6c,00,\
  2d,00,38,00,2e,00,30,00,2e,00,33,00,31,00,2d,00,77,00,69,00,6e,00,78,00,36,\
  00,34,00,5c,00,62,00,69,00,6e,00,5c,00,6d,00,79,00,73,00,71,00,6c,00,64,00,\
  2e,00,65,00,78,00,65,00,22,00,20,00,4d,00,79,00,53,00,51,00,4c,00,00,00
"DisplayName"="MySQL"
"WOW64"=dword:0000014c
"ObjectName"="LocalSystem"

switch bat

echo off
echo 1 mysql5.1 
echo 2 mysql8.0
set /p var=请选择:

goto e%var%
goto end
:e2
net stop mysql
%~dp0\mysql8.0\reg8.0.reg
net start mysql
goto end
:e1
net stop mysql
"%~dp0\mysqlBag\MySQL Server 5.1_reg.reg"
net start mysql
goto end
pause

Note: The code segment needs to be partially modified according to the installation environment of the computer itself

Guess you like

Origin blog.csdn.net/glc22/article/details/127540732