安装 绿色版mysql服务的批处理
先设置好MYSQL_HOME的环境变量
然后执行以下批处理
@echo off If not Defined MYSQL_HOME ( set "error_msg=MYSQL_HOME 变量不存在,请先设置MYSQL_HOME环境变量" goto :error ) call :create_mysql_ini call :install_mysql_server :error echo %error_msg% pause exit :create_mysql_ini set "unit_mysql_home=%MYSQL_HOME::\=:/%" echo "%unit_mysql_home%" set "my_ini_dir=%unit_mysql_home%\my.ini" echo [mysqld] > %my_ini_dir% echo port = 3306 >> %my_ini_dir% echo basedir = %unit_mysql_home% >> %my_ini_dir% echo datadir = %unit_mysql_home%\data >> %my_ini_dir% echo character_set_server = utf8 >> %my_ini_dir% echo max_allowed_packet = 1M >> %my_ini_dir% echo. >> %my_ini_dir% echo [client] >> %my_ini_dir% echo port = 3306 >> %my_ini_dir% echo default-character-set = utf-8 >> %my_ini_dir% echo 创建mysql配置文件成功 goto:eof :install_mysql_server net stop MySQL echo 1 sc delete MySQL echo 1 mysqld --install MySQL --defaults-file=%my_ini_dir% set "mysql_server_excute_path="%MYSQL_HOME%\bin\mysqld" --defaults-file=%my_ini_dir% MYSQL" echo %mysql_server_excute_path% reg add HKLM\SYSTEM\CurrentControlSet\Services\MySQL /v ImagePath /t REG_EXPAND_SZ /d "%mysql_server_excute_path%" /f echo 1 net start MySQL echo 安装mysql服务成功 goto :eof
相关推荐
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11
世樹 2020-11-11