Using batch implementation under Windows to start shutdown Mysql_dos/bat

Source: Internet
Author: User
Tags goto

Register the green version of MySQL as a service under Windows, or install a version of the MySQL Windows service can be used

Mysql.bat

CLS @echo off: Setting window font colors Color 0a: Setting window title title "MySQL Admin program call:checkadmin goto Menu: Menu: The menu cls Echo.
echo.=-=-=-=-Please select the operation you want for MySQL-=-=-=-=-echo.
Echo.1: Start MySQL echo. 
Echo.2: Close 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. Close mysql ... net stop "MySQL" echo. Close MySQL Success!
Pause goto Menu: reboot: Reboot echo.
Call:checkmysql 2 echo. Close mysql ... net stop "MySQL" echo. Close 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 started G
 Oto goout) If%count% equ 0 if "%1" equ "2" ( echo Warning: MySQL does not start goto goout: Check to be run as 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

Demo diagram:

The above mentioned is the entire content of this article, I hope you can enjoy, can be proficient in the batch processing has helped.

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.