@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=54034 >>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=54034 >>my.ini echo default-character-set=utf8mb4 cd bin "%mysqlpath%\bin\mysqld.exe" install ct --defaults-file="%mysqlpath%\my.ini" rem ����mysql�������� echo ----2. start Mysql service---- >>../log.txt rem pause net start ct sc config ct start= auto net stop ct net start ct 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 < "%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_CT",username="",VariableValue="%mysqlpath%" rem ׷��path���� wmic ENVIRONMENT where "name='PATH' and username=''" set VariableValue="%path%;%%MYSQL_HOME_CT%%\bin;" echo ----4. Mysql environment create/append success---->>/log.txt ) pause >nul