A batch file that was written earlier when the MySQL interface was debugged.
Register to start My_install.bat
@echo Offset Mysql_dir=%~dp0rem set mysql_dir=%cd%if not "%mysql_home%" = "" ( If not "%mysql_home%" = = "%mysql_dir%" ( echo mysql_home=%mysql_home% = mysql_dir=%mysql_dir% goto my_ends )) Else ( set Mysql_home=%mysql_ dir% echo Mysql_home must be set as mysql_dir=%mysql_dir%) set path=%mysql_home%bin;%mysql_home%lib;%path% Mysqladmin-uroot Ping 1>nul 2>nul@if "%errorlevel%" = = "0" ( Echo Mysql is running. Goto my_ends) echo "mysql_home =%mysql_home%" echo Install and start MYSQL server ... mysqld--install MYSQL_SRVSC config my Sql_srv start= demandrem sc query mysql_srvnet start mysql_srvrem sc query mysql_srvmysqladmin-uroot ping 1>nul 2& gt;nul@if "%errorlevel%" = = "0" echo "Mysql started successfully": my_endscmd/k
Deactivate uninstall My_uninstall.bat
@echo Offset Mysql_dir=%~dp0rem set mysql_dir=%cd%if not "%mysql_home%" = "" ( If not "%mysql_home%" = = "%mysql_dir%" ( echo mysql_home=%mysql_home% = mysql_dir=%mysql_dir% goto my_ends )) Else set Mysql_home=%mysql_dir%set Path=%mysql_home%\bin;%mysql_home%\lib;%path%echo "mysql_home =%mysql_home%" echo Stop and uninstall MYSQL server ... Mysqladmin-uroot Ping 1>nul 2>nul@if "%errorlevel%" = = "0" ( net stop mysql_srv rem sc query mysql _SRV) mysqld--remove mysql_srv:my_endspause
MYSQL Registration start and Deactivate uninstall batch script (complement)