免解压版的Mysql的启动脚本,并且执行导入(windows)

@echo off

rem ###################

set MYSQL_VERSION=mysql-5.5.32-win32



set LOCK=wot.lock

rem ###################

set CURRENT_DIR=%cd%



cd %MYSQL_VERSION%

echo start Mysql,please wait...

net stop mysqlwot 

bin\\mysqld.exe -remove mysqlwot

bin\\mysqld.exe -install mysqlwot --defaults-file=%CURRENT_DIR%\\%MYSQL_VERSION%\\my.ini

net start mysqlwot 

if exist %CURRENT_DIR%\\%MYSQL_VERSION%\\%LOCK% (

	rem echo nothing do

) else (

	echo "Import databases from sql file,please wait..."

	bin\\mysql.exe -uroot -proot <%CURRENT_DIR%\\platform_core.sql

	echo "Import success..."

	echo "wot mysql lock,do not delete it.">%CURRENT_DIR%\\%MYSQL_VERSION%\\%LOCK%

)





rem call bin\\mysqld --defaults-file=%CURRENT_DIR%\\%MYSQL_VERSION%\\my.ini --console

echo "Mysql start success..."



pause;

 

 

其中:使用到了

set定义变量

if else 条件判定。

注册删除服务

创建文件,

判定文件是否存在,

 


 

 

你可能感兴趣的:(windows)