2009年3月14日星期六

本人制作的MySQL选择启动、停止、控制台的脚本

如果是网上下载的绿色版的MySQL,启动MySQL的时候每次都要到bin路径下双击mysqld去启动进程。
为了方便控制MySQL的启动、停止还有进入Terminal,制作了一个cmd脚本,把一下文件保存成mysql.bat,
双击运行,选择1--启动 2--进入Terminal 3--停止

@echo off
CHOICE /C 0123 /M "----MySQL Server start|terminal|stop, press 1|2|3, 0 to cancel.----"

if errorlevel 4 goto stop
if errorlevel 3 goto terminal
if errorlevel 2 goto start
if errorlevel 1 goto end

:start
echo ===You have chosen to start the MySQL Server===
E:\mysql-5.1.28-rc-win32\bin\mysqld.exe --console
rem mysqld.exe的路径请自行修改,--console选项可以去掉,就不会显示soncole画面
rem 尽量不用有空格的路径
goto end

:stop
echo ===You have chosen to stop the MySQL Server===
E:\mysql-5.1.28-rc-win32\bin\mysqladmin.exe -uroot -p shutdown
rem mysqladmin.exe的路径请自行修改
goto end

:terminal
echo ===You have chosen to enter terminal for MySQL===
E:\mysql-5.1.28-rc-win32\bin\mysql.exe -uroot -p
rem mysql.exe的路径请自行修改

:end
echo Bye

Windows XP下不认识choise这个命令,改用以下的脚本:
@echo off
echo ----MySQL Server start/terminal/stop, press 1/2/3, 0 to cancel.----
set /p Choice={0,1,2,3}
if '%Choice%'=='0' GOTO end
if '%Choice%'=='1' GOTO start
IF '%Choice%'=='2' GOTO terminal
IF '%Choice%'=='3' GOTO stop

:start
echo ===You have chosen to start the MySQL Server===
D:/program/MySQL/bin/mysqld.exe --console
rem mysqld.exe的路径请自行修改,--console选项可以去掉,就不会显示soncole画面
goto end

:stop
echo ===You have chosen to stop the MySQL Server===
D:/program/MySQL/bin/mysqladmin.exe -uroot -p shutdown
rem mysqladmin.exe的路径请自行修改
goto end

:terminal
echo ===You have chosen to enter terminal for MySQL===
D:/program/MySQL/bin/mysql.exe -uroot -p
rem mysql.exe的路径请自行修改

:end
echo Bye
本人制作的MySQL选择启动、停止、控制台的脚本

3 条评论:

goooooood girl 说...

your blog is very fine......

Terry 说...

really? thanks!

匿名 说...

你的博客很精辟的

Swift Hash&Convert,写了第一个Mac小程序

README Swift Hash&Convert https://github.com/yaoxinghuo/SwiftHash Hash&Convert app for Mac, for develop use, written in ...