service.bat 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 MONGODB_HOME=%DATA_PATH%\mongodb
  9. %MYSQL_HOME%\bin\mysql -P3307 -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'laser'";
  10. %MYSQL_HOME%\bin\mysql -P3307 -u root -plaser -e "CREATE DATABASE IF NOT EXISTS `laser` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ";
  11. echo start db tables
  12. if exist %USER_DATA%\lite.sql (
  13. echo "file exists"
  14. %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %USER_DATA%\lite.sql
  15. del %USER_DATA%\lite.sql
  16. ) else (
  17. echo "file no exists"
  18. %MYSQL_HOME%\bin\mysql.exe -P3307 -u root -plaser laser < %MYSQL_HOME%\sqlfile\fdkk_laser.sql
  19. )
  20. echo ---Installation mysql completed---
  21. )
  22. if exist %USER_DATA%\mon\ (
  23. echo "file exists"
  24. %MONGODB_HOME%\bin\mongorestore.exe --host 127.0.0.1 --port 29031 --gzip %USER_DATA%\mon
  25. rd /s /q %USER_DATA%\mon
  26. ) else (
  27. echo "file no exists"
  28. %MONGODB_HOME%\bin\mongorestore.exe --host 127.0.0.1 --port 29031 --gzip %MONGODB_HOME%\script
  29. )
  30. rd /s /q %USER_DATA%
  31. ping -n 3 127.1>nul
  32. del %0