setup mysql update
This commit is contained in:
@@ -1,82 +1,54 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Rem check Mysql
|
||||
|
||||
Rem download mysql
|
||||
START Https://dev.mysql.com/downloads/installer/
|
||||
|
||||
|
||||
@echo off
|
||||
setlocal
|
||||
:pick_a_new_port
|
||||
set /P port=Insert a %new%port?
|
||||
netstat -an | findstr /RC:":%port% .*LISTENING" 1>nul 2>nul && (ECHO Port is in use & set new=new & goto pick_a_new_port)
|
||||
echo %port% ok
|
||||
|
||||
pause
|
||||
|
||||
|
||||
pause
|
||||
|
||||
cls
|
||||
:start
|
||||
ECHO What do you want to do?
|
||||
ECHO 1. Click 1 to setup a Server machine
|
||||
ECHO 2. Click 2 to setup a Client Machine
|
||||
ECHO 3. Click 3 to setup a Student Terminal
|
||||
ECHO 4. Click 4 to cancel and quit
|
||||
set /p choice=Type the number to proceed to setup.
|
||||
rem if not '%choice%'=='' set choice=%choice:~0;1% ( don`t use this command, because it takes only first digit in the case you type more digits. After that for example choice 23455666 is choice 2 and you get "bye"
|
||||
netstat -o -n -a | findstr 3306
|
||||
if %ERRORLEVEL% equ 0 goto FOUND
|
||||
echo MySql not found or not usisng default port 3306...
|
||||
ECHO Do you wanto open open browser to download it?
|
||||
ECHO 1. yes
|
||||
ECHO 2. no
|
||||
set /p choice=Choose your option.
|
||||
if '%choice%'=='' ECHO "%choice%" is not valid please try again
|
||||
if '%choice%'=='1' goto server
|
||||
if '%choice%'=='2' goto client
|
||||
if '%choice%'=='3' goto terminal
|
||||
if '%choice%'=='4' goto quit
|
||||
if '%choice%'=='1' goto open
|
||||
if '%choice%'=='2' goto FIN
|
||||
ECHO.
|
||||
goto start
|
||||
:server
|
||||
ECHO Starting installing and setup the server....
|
||||
ECHO -------------------------------------------------
|
||||
ECHO First take a note of your ip number shown above.
|
||||
ECHO You will need this to install the clients and terminals:
|
||||
for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %ComputerName% ^| findstr [') do set NetworkIP=%%a
|
||||
echo Network IP:
|
||||
ECHO ------------------------------------------------------
|
||||
ECHO %NetworkIP%
|
||||
ECHO ------------------------------------------------------
|
||||
:open
|
||||
echo opening the Mysql download link....
|
||||
pause
|
||||
call setupFiles.bat
|
||||
ECHO ok
|
||||
ECHO -------------------------------------------------------
|
||||
echo localhost>C:\Librography\ipserver
|
||||
call setupJava.bat
|
||||
|
||||
ECHO
|
||||
goto end
|
||||
:client
|
||||
ECHO Starting installing and setup the client....
|
||||
ECHO -------------------------------------------------
|
||||
call setupFiles.bat
|
||||
Rem setup server ip
|
||||
echo Enter the server ip :
|
||||
set /p ipserver=
|
||||
echo The server ip is %ipserver%
|
||||
echo %ipserver%>C:\Librography\ipserver
|
||||
|
||||
|
||||
ECHO BYE
|
||||
goto end
|
||||
:terminal
|
||||
ECHO TEST
|
||||
goto end
|
||||
:quit
|
||||
ECHO Bye
|
||||
goto end
|
||||
:end
|
||||
START Https://dev.mysql.com/downloads/installer/
|
||||
ECHO you can download the setup fromlink now and after install it we will continue the setup
|
||||
ECHO choose the default options on setup and don`t forget to take a note of the root password
|
||||
pause
|
||||
Rem exit
|
||||
Rem :continue
|
||||
Rem echo ok
|
||||
goto start
|
||||
Rem goto FIN
|
||||
:FOUND
|
||||
echo port found. It mean the Mysql is installed
|
||||
echo we can continue the setup...
|
||||
pause
|
||||
:FIN
|
||||
|
||||
echo .
|
||||
echo .
|
||||
@echo off
|
||||
rem ------------------------------------------------
|
||||
echo Creating access to user. Waiting ...
|
||||
echo Enter the MySql root password:
|
||||
set /p rootpassword=
|
||||
set dbuser=gowl
|
||||
set userpassword=gowl
|
||||
Rem "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" "--defaults-file=C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" "-uroot" "-p"
|
||||
SET PATH=%PATH%;C:\Program Files\MySQL\MySQL Server 5.7\bin
|
||||
mysql -uroot -p%rootpassword% --execute="CREATE DATABASE %dbuser%;"
|
||||
mysql -uroot -p%rootpassword% --execute="CREATE USER '%dbuser%'@'localhost' IDENTIFIED BY '%userpassword%';"
|
||||
mysql -uroot -p%rootpassword% --execute="GRANT ALL PRIVILEGES ON %dbuser%.* TO '%dbuser%'@'localhost';"
|
||||
|
||||
mysql -uroot -p%rootpassword% --execute="FLUSH PRIVILEGES;"
|
||||
echo Done.
|
||||
echo "MySQL user created."
|
||||
echo "Username: %dbuser%"
|
||||
echo "Password: %userpassword%"
|
||||
rem ------------------------------------------------
|
||||
echo .
|
||||
echo .
|
||||
|
||||
Reference in New Issue
Block a user