MySQL start off batch processing, feel very good to find on other forum posts, thanks for sharing

Source: Internet
Author: User

Recently with MySQL more time, each time under the Computer Management tools to start, feel very troublesome, so the search has been made by the predecessors have done these things, today collection finishing, MySQL start off batch processing feel very good to find in other forum posts, thanks to the selfless friends on the Internet to share, The following code directly copied and pasted into a bat file double-click to use

Cls
@echo off
: Set Window Font Color
Color 0a
: Set Window Caption
TITLE MySQL Management program

Call:checkadmin

Goto Menu
: Menu
: Menu
Cls
Echo.
echo.=-=-=-=-Please select what you want to do with MySQL-=-=-=-=-
Echo.
Echo.1: Start MySQL
Echo.
Echo.2: Turn off MySQL
Echo.
Echo.3: Restart MySQL
Echo.
Echo.4: Exit
Echo.
echo.=-=-=-=-Please enter the item number you want to select ↓-=-=-=-
set/p id=
If "%id%" = = "1" Goto startup
If "%id%" = = "2" goto shutdown
If "%id%" = = "3" goto reboot
If "%id%" = = "4" Exit
Pause

: Start
: Startup
Echo.
Call:checkmysql 1
echo. Start MySQL ...
net start "MySQL"
echo. start MySQL success!
Pause
Goto Menu

: Stop
: Shutdown
Echo.
Call:checkmysql 2
echo. Turn off MySQL ...
net stop "MySQL"
echo. Turn off MySQL success!
Pause
Goto Menu

: Restart
: Reboot
Echo.
Call:checkmysql 2
echo. Turn off MySQL ...
net stop "MySQL"
echo. Turn off MySQL success!
Goto Startup
Goto Menu

: Exit
: Goout
Pause
Goto Menu

: Check if the MySQL process exists
: Checkmysql
set/a count=0
for/f "Tokens=1 delims="%%i in (' Tasklist/nh ^| find/i "MySQL") do (set/a count+=1)
If%count% NEQ 0 if "%1" equ "1" (
Echo Warning: MySQL is started
Goto Goout
)
If%count% equ 0 if "%1" equ "2" (
echo Warning: MySQL does not start
Goto Goout
)

: Check if you are running as an administrator
: Checkadmin
echo Test am I admin? >%systemroot%\system32\test.sunhao
If not exist%systemroot%\system32\test.sunhao (
Echo WARNING: Please run as Administrator!
Pause
Exit
)
Del%systemroot%\system32\test.sunhao

MySQL start off batch processing, feel very good to find on other forum posts, thanks for sharing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.