service.bat 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. @echo off && setlocal enabledelayedexpansion
  2. title 4dmega install
  3. color 0a
  4. echo ---Installation completed---
  5. set DATA_PATH=%1
  6. set USER_DATA=%DATA_PATH%\USER_DATA
  7. set MYSQL_HOME=%DATA_PATH%\mysql
  8. set TOOLS_HOME=%DATA_PATH%\tools
  9. set MONGODB_HOME=%DATA_PATH%\mongodb
  10. %MYSQL_HOME%\bin\mysql -P3307 -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'laser'";
  11. %MYSQL_HOME%\bin\mysql -P3307 -u root -plaser -e "CREATE DATABASE IF NOT EXISTS `laser` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ";
  12. echo start db tables
  13. if exist %USER_DATA%\lite.sql (
  14. echo "file exists"
  15. %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %USER_DATA%\lite.sql
  16. del %USER_DATA%\lite.sql
  17. ) else (
  18. if exist %MYSQL_HOME%\sqlfile\fdkk_laser.sql (
  19. echo "file exists"
  20. %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %MYSQL_HOME%\sqlfile\fdkk_laser.sql
  21. ) else (
  22. echo "file no exists"
  23. )
  24. )
  25. echo ---Installation mysql completed---
  26. if exist %USER_DATA%\mon\ (
  27. echo "file exists"
  28. %MONGODB_HOME%\bin\mongorestore.exe --host 127.0.0.1 --port 29031 --gzip %USER_DATA%\mon
  29. rd /s /q %USER_DATA%\mon
  30. ) else (
  31. echo "file no exists"
  32. %MONGODB_HOME%\bin\mongorestore.exe --host 127.0.0.1 --port 29031 --gzip %MONGODB_HOME%\script
  33. )
  34. rd /s /q %USER_DATA%
  35. ping -n 3 127.1>nul