最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

window java 一键启动部署 mysql,jar

IT圈 admin 7浏览 0评论

window java 一键启动部署 mysql,jar

目录说明

  1. back:目录备份
  2. install jar包目录
  3. mysql 解压版 下载地址.7.html#downloads
  4. service.bat java启动jar命令
  5. start.bat 一键启动命令
  6. 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%\binset 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 overset 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.battimeout /nobreak -t 10start 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 numberset 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;

window java 一键启动部署 mysql,jar

目录说明

  1. back:目录备份
  2. install jar包目录
  3. mysql 解压版 下载地址.7.html#downloads
  4. service.bat java启动jar命令
  5. start.bat 一键启动命令
  6. 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%\binset 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 overset 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.battimeout /nobreak -t 10start 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 numberset 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;
发布评论

评论列表 (0)

  1. 暂无评论