mysql 解压版 下载地址https://dev.mysql.com/downloads/mysql/5.7.html#downloads
service.bat java启动jar命令
start.bat 一键启动命令
stop.bat 停止服务
service.bat内容
rem java -jar device.jar
rem start javaw -Xms1024m -Xmx1024m -jar device.jar
echo starting...
set pa=%cd%\install
set JAVA_HOME=%pa%\jdk
set path=%JAVA_HOME%\bin
set serverPort=8084
start javaw -Xmx1024m -Xms1024m -jar ./install/device.jar --server.port=%serverPort%
exit;
start.bat 内容
@echo off
set serverName=mysql
set dbPort=3306
set serverPort=8084
SC QUERY %serverName%> NUL
IF ERRORLEVEL 1060 GOTO NOTEXIST
GOTO EXIST
:NOTEXIST
ECHO not exist %serverName% service
cd mysql
echo newpath=%cd%
del /F %cd%\my.ini
echo del success
echo [mysql]>> my.ini
echo default-character-set=utf8>> my.ini
echo [mysqld]>> my.ini
echo port = %dbPort%>> my.ini
echo basedir=%cd%>> my.ini
echo datadir=%cd%\data>> my.ini
echo max_connections=200>> my.ini
echo character-set-server=utf8>> my.ini
echo default-storage-engine=INNODB>> my.ini
echo wait_timeout=2147483>> my.ini
echo interactive_timeout=2147483>> my.ini
echo over
set iniFile=%cd%\my.ini
"%cd%\bin\mysqld.exe" -install mysql --defaults-file="%iniFile%"
"%cd%\bin\mysqld.exe" --initialize-insecure --user=mysql --console
net start mysql
sc config mysql start=auto
net stop mysql
net start mysql
echo install over
"%cd%\bin\mysqladmin.exe" -P%dbPort% -uroot password micronview2022
echo change password success
"%cd%\bin\mysql.exe" -P%dbPort% -uroot -pmicronview2022 < "%cd%\device.sql"
cd ..
echo newpath=%cd%
echo database init over
GOTO END
:EXIST
ECHO exist %serverName% service
GOTO END
:END
echo exe %cd%/service.bat
start %cd%/service.bat
timeout /nobreak -t 10
start http://127.0.0.1:%serverPort%/index.html
rem exit
exit;
stop.bat 内容
@echo off
rem Step 1. Find the java process according to the port number and end the process
rem Set the listening port number
set serverPort=8084
echo port : %serverPort%
for /f "usebackq tokens=1-5" %%a in (`netstat -ano ^| findstr %serverPort%`) do (
if [%%d] EQU [LISTENING] (
set pid=%%e
)
)
for /f "usebackq tokens=1-5" %%a in (`tasklist ^| findstr %pid%`) do (
set image_name=%%a
)
echo now will kill process : pid %pid%, image_name %image_name%
rem Kill process according to process ID
taskkill /f /pid %pid%
timeout /nobreak /t 2
exit;