Skip to content

Commit

Permalink
Fixing basic install route
Browse files Browse the repository at this point in the history
Just so it barely functions better mostly with the files it already has, plus the quick script that I added.
World FullDB had 2 errors, create scripts could probably be included in bat file allowing customizable schema names, even this entire project could be deduplicated with the main one, which could be done for all C++ cores as well, including the data if it is the same too.
Quick script adapted from mangoszero/database#132.
  • Loading branch information
Pysis868 committed Feb 22, 2023
1 parent 8587d05 commit 143659f
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 52 deletions.
50 changes: 31 additions & 19 deletions Install_Account.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
:quick
rem Quick install section
rem This will automatically use the variables below to install the Account database without prompting then optimize them and exit
rem To use: Set your environment variables below and change 'set quick=off' to 'set quick=on'
set quick=off
rem To use: Configure and run Install_Quick.bat, or set your environment variables below, change 'set quick=off' to 'set quick=on', and run this individual file instead.
IF NOT DEFINED quick set quick=off
IF NOT DEFINED skipPause set skipPause=off
IF NOT DEFINED skipDone set skipDone=off
if %quick% == off goto standard
echo (( Mangos Account Database Quick Installer ))
rem -- Change the values below to match your server --
set svr=localhost
set user=root
set pass=rootpass
set port=3306
set wdb=realmd
IF NOT DEFINED DEBUG set DEBUG=NO
IF NOT DEFINED svr set svr=localhost
IF NOT DEFINED user set user=root
IF NOT DEFINED pass set pass=rootpass
IF NOT DEFINED port set port=3306
IF NOT DEFINED adb set adb=realmd
rem -- Don't change past this point --
set yesno=y
goto install
Expand Down Expand Up @@ -45,16 +48,22 @@ set /p pass=What is your MySQL password? [rootpass] :
if %pass%. == . set pass=rootpass
set /p port=What is your MySQL port? [3306] :
if %port%. == . set port=3306
set /p wdb=What is your Account database name? [mangosVBaccounts] :
if %wdb%. == . set wdb=mangosVBaccounts
set /p adb=What is your Account database name? [mangosVBaccounts] :
if %adb%. == . set adb=mangosVBaccounts

:install
set dbpath=Realm\Setup
set mysql=tools
IF NOT DEFINED mysqlDir set mysqlDir=tools
IF NOT DEFINED mysqlExeName set mysqlExeName=mysql.exe
set mysqlExePath=%mysqlDir%\%mysqlExeName%
IF NOT DEFINED mysqlConnectionOptions set mysqlConnectionOptions=-h %svr% --user=%user% --password=%pass% --port=%port%
IF NOT DEFINED mysqlConnectionOtherOptions set mysqlConnectionOtherOptions=-q -s
IF NOT DEFINED mysqlConnectionString set mysqlConnectionString=%mysqlExePath% %mysqlConnectionOptions% %mysqlConnectionOtherOptions%
IF %DEBUG%==YES echo mysqlConnectionString: %mysqlConnectionString%

:checkpaths
if not exist %dbpath% then goto patherror
if not exist %mysql%\mysql.exe then goto patherror
if not exist %dbpath% goto patherror
if not exist %mysqlExePath% goto patherror
goto world

:patherror
Expand All @@ -70,11 +79,14 @@ if %quick% == off set /p yesno=Do you wish to continue? (y/n)
echo.
echo Importing Account database

REM for %%i in (%dbpath%\*.sql) do echo %%i & %mysql%\mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < %%i
%mysql%\mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < %dbpath%\realmdLoadDB.sql
%mysql%\mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < Tools\updateRealm.sql
REM for %%i in (%dbpath%\*.sql) do echo %%i & %mysqlConnectionString% %adb% < %%i
%mysqlConnectionString% < %dbpath%\realmdCreateDB.sql
%mysqlConnectionString% %adb% < %dbpath%\realmdLoadDB.sql
%mysqlConnectionString% %adb% < Tools\updateRealm.sql
:done
echo.
echo Done :)
echo.
pause
IF NOT "%skipPause%"=="on" (
echo.
echo Done :)
echo.
)
IF NOT "%skipPause%"=="on" pause
46 changes: 29 additions & 17 deletions Install_Characters.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
:quick
rem Quick install section
rem This will automatically use the variables below to install the Characters database without prompting then optimize them and exit
rem To use: Set your environment variables below and change 'set quick=off' to 'set quick=on'
set quick=off
rem To use: Configure and run Install_Quick.bat, or set your environment variables below, change 'set quick=off' to 'set quick=on', and run this individual file instead.
IF NOT DEFINED quick set quick=off
IF NOT DEFINED skipPause set skipPause=off
IF NOT DEFINED skipDone set skipDone=off
if %quick% == off goto standard
echo (( Mangos Character Database Quick Installer ))
rem -- Change the values below to match your server --
set svr=localhost
set user=root
set pass=rootpass
set port=3306
set wdb=character0
IF NOT DEFINED DEBUG set DEBUG=NO
IF NOT DEFINED svr set svr=localhost
IF NOT DEFINED user set user=root
IF NOT DEFINED pass set pass=rootpass
IF NOT DEFINED port set port=3306
IF NOT DEFINED cdb set cdb=character0
rem -- Don't change past this point --
set yesno=y
goto install
Expand Down Expand Up @@ -45,16 +48,22 @@ set /p pass=What is your MySQL password? [rootpass] :
if %pass%. == . set pass=rootpass
set /p port=What is your MySQL port? [3306] :
if %port%. == . set port=3306
set /p wdb=What is your Characters database name? [mangosVBcharacters] :
if %wdb%. == . set wdb=mangosVBcharacters
set /p cdb=What is your Characters database name? [mangosVBcharacters] :
if %cdb%. == . set cdb=mangosVBcharacters

:install
set dbpath=Character\Setup
set mysql=tools
IF NOT DEFINED mysqlDir set mysqlDir=tools
IF NOT DEFINED mysqlExeName set mysqlExeName=mysql.exe
set mysqlExePath=%mysqlDir%\%mysqlExeName%
IF NOT DEFINED mysqlConnectionOptions set mysqlConnectionOptions=-h %svr% --user=%user% --password=%pass% --port=%port%
IF NOT DEFINED mysqlConnectionOtherOptions set mysqlConnectionOtherOptions=-q -s
IF NOT DEFINED mysqlConnectionString set mysqlConnectionString=%mysqlExePath% %mysqlConnectionOptions% %mysqlConnectionOtherOptions%
IF %DEBUG%==YES echo mysqlConnectionString: %mysqlConnectionString%

:checkpaths
if not exist %dbpath% then goto patherror
if not exist %mysql%\mysql.exe then goto patherror
if not exist %dbpath% goto patherror
if not exist %mysqlExePath% goto patherror
goto world

:patherror
Expand All @@ -70,10 +79,13 @@ if %quick% == off set /p yesno=Do you wish to continue? (y/n)
echo.
echo Importing Character database

for %%i in (%dbpath%\*.sql) do echo %%i & %mysql%\mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < %%i
%mysqlConnectionString% < Tools\characterCreateDB.sql
for %%i in (%dbpath%\*.sql) do echo %%i & %mysqlConnectionString% %cdb% < %%i

:done
echo.
echo Done :)
echo.
pause
IF NOT "%skipPause%"=="on" (
echo.
echo Done :)
echo.
)
IF NOT "%skipPause%"=="on" pause
48 changes: 48 additions & 0 deletions Install_Quick.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@echo off

REM You can use this file to quickly configure and run all included scripts for the database schemas, or individual ones when provided with the desired script as the first parameter, such as dragging that script onto this one.
REM Configuration involves uncommenting any of the following lines by removing the "REM " prefix text for any setting you need to provide for your database installation that does not match a default value, by also providing your custom after the "=".

set quick=on
set skipPause=on
set skipDone=on

REM set DEBUG=YES

REM set mysqlDir=tools
REM set mysqlExeName=mysql.exe
REM set mysqlConnectionOtherOptions=-q -v
REM set mysqlConnectionOptions=--login-path=root-local-My8
REM set svr=localhost
REM set user=root
REM set pass=rootpass
REM set port=3306
REM set adb=realmd
REM set cdb=character0
REM set wdb=mangos0

IF "%1" == "" (
echo Will execute all 3 scripts.
) ELSE (
echo Will only execute this script: %~nx1
)
echo.

set /p ready="Ready? (Y/<*>): "
IF NOT DEFINED ready set ready=N
if %ready% == Y GOTO EXECUTE:
if %ready% == y GOTO EXECUTE:

GOTO :EOF

:Execute
cd %~dp0
%~d0
IF "%1" == "" (
CALL Install_Account.bat
CALL Install_Characters.bat
CALL Install_World.bat
pause
) ELSE (
CALL %~nx1
)
45 changes: 29 additions & 16 deletions Install_World.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
:quick
rem Quick install section
rem This will automatically use the variables below to install the World database without prompting then optimize them and exit
rem To use: Set your environment variables below and change 'set quick=off' to 'set quick=on'
set quick=off
rem To use: Configure and run Install_Quick.bat, or set your environment variables below, change 'set quick=off' to 'set quick=on', and run this individual file instead.
IF NOT DEFINED quick set quick=off
IF NOT DEFINED skipPause set skipPause=off
IF NOT DEFINED skipDone set skipDone=off
if %quick% == off goto standard
echo (( Mangos World Database Quick Installer ))
rem -- Change the values below to match your server --
set svr=localhost
set user=root
set pass=rootpass
set port=3306
set wdb=mangosVBworld
IF NOT DEFINED DEBUG set DEBUG=NO
IF NOT DEFINED svr set svr=localhost
IF NOT DEFINED user set user=root
IF NOT DEFINED pass set pass=rootpass
IF NOT DEFINED port set port=3306
REM IF NOT DEFINED wdb set wdb=mangosVBworld
IF NOT DEFINED wdb set wdb=mangos0
rem -- Don't change past this point --
set yesno=y
goto install
Expand Down Expand Up @@ -50,11 +54,17 @@ if %wdb%. == . set wdb=mangosVBworld

:install
set dbpath=World\Setup
set mysql=tools
IF NOT DEFINED mysqlDir set mysqlDir=tools
IF NOT DEFINED mysqlExeName set mysqlExeName=mysql.exe
set mysqlExePath=%mysqlDir%\%mysqlExeName%
IF NOT DEFINED mysqlConnectionOptions set mysqlConnectionOptions=-h %svr% --user=%user% --password=%pass% --port=%port%
IF NOT DEFINED mysqlConnectionOtherOptions set mysqlConnectionOtherOptions=-q -s
IF NOT DEFINED mysqlConnectionString set mysqlConnectionString=%mysqlExePath% %mysqlConnectionOptions% %mysqlConnectionOtherOptions%
IF %DEBUG%==YES echo mysqlConnectionString: %mysqlConnectionString%

:checkpaths
if not exist %dbpath% then goto patherror
if not exist %mysql%\mysql.exe then goto patherror
if not exist %dbpath% goto patherror
if not exist %mysqlExePath% goto patherror
goto world

:patherror
Expand All @@ -70,11 +80,14 @@ if %quick% == off set /p yesno=Do you wish to continue? (y/n)
echo.
echo Importing World database

%mysql%\mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < %dbpath%\mangosdLoadDB.sql
for %%i in (%dbpath%\FullDB\*.sql) do echo %%i & %mysql%\mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < %%i
%mysqlConnectionString% < Tools\mangosdCreateDB.sql
REM for %%i in (%dbpath%\FullDB\*.sql) do echo %%i & %mysqlConnectionString% %wdb% < %%i
%mysqlConnectionString% %wdb% < %dbpath%\mangosdLoadDB.sql

:done
echo.
echo Done :)
echo.
pause
IF NOT "%skipPause%"=="on" (
echo.
echo Done :)
echo.
)
IF NOT "%skipPause%"=="on" pause
3 changes: 3 additions & 0 deletions Tools/characterCreateDB.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE DATABASE `character0` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES ON `character0`.* TO 'mangos'@'localhost';
5 changes: 5 additions & 0 deletions Tools/mangosdCreateDB.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE DATABASE IF NOT EXISTS `mangos0` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, LOCK TABLES, CREATE ROUTINE, ALTER ROUTINE ON `mangos0`.* TO 'mangos'@'localhost';

FLUSH PRIVILEGES;

0 comments on commit 143659f

Please sign in to comment.