1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- @echo off
- rem ������·���л�����ǰ�ű�����Ŀ¼
- cd /d %~dp0
- rem ��ʼ��װmysql
- echo ----1.start installing Mysql ---->>../log.txt
- "%cd%\mysqld.exe" --initialize-insecure --user=mysql --console
- cd ..
- set "mysqlpath=%cd%">>../log.txt
- set basedir=%cd%
- set basedir=%basedir:\=/%
- >my.ini echo [mysqld]
- >>my.ini echo port=54042
- >>my.ini echo basedir=%basedir%
- >>my.ini echo datadir=%basedir%/Data
- >>my.ini echo max_connections=200
- >>my.ini echo max_connect_errors=10
- >>my.ini echo character-set-server=utf8mb4
- >>my.ini echo default-storage-engine=INNODB
- >>my.ini echo local_infile=ON
- >>my.ini echo.
- >>my.ini echo [mysql]
- >>my.ini echo default-character-set=utf8mb4
- >>my.ini echo local_infile=ON
- >>my.ini echo.
- >>my.ini echo [client]
- >>my.ini echo port=54042
- >>my.ini echo default-character-set=utf8mb4
- cd bin
- "%mysqlpath%\bin\mysqld.exe" install ctV2 --defaults-file="%mysqlpath%\my.ini"
- rem ����mysql��������
- echo ----2. start Mysql service---- >>../log.txt
- rem pause
- net start ctV2
- sc config ctV2 start= auto
- net stop ctV2
- net start ctV2
- rem ����mysql���������������д������ݿ��ʼ��
- echo ----3.setting Mysql environment ---->>../log.txt
- cd ..
- "%cd%\bin\mysqladmin" -u root password Mysql@.2020
- "%cd%\bin\mysql.exe" -uroot -pMysql@.2020 ct_v2 < "%cd%\sql\grant.sql"
- echo %Path%
- echo %Path%|find /i "%mysqlpath%" && set IsNull=true || set IsNull=false
- echo %IsNull%
- if not %IsNull%==true (
- wmic ENVIRONMENT create name="MYSQL_HOME_CTV2",username="<system>",VariableValue="%mysqlpath%"
- rem ��path����
- wmic ENVIRONMENT where "name='PATH' and username='<system>'" set VariableValue="%path%;%%MYSQL_HOME_CTV2%%\bin;"
- echo ----4. Mysql environment create/append success---->>/log.txt
- )
- pause >nul
|