MYSQL registration Start and Stop unmount batch processing script (Supplement), mysql Batch Processing

Source: Internet
Author: User

MYSQL registration Start and Stop unmount batch processing script (Supplement), mysql Batch Processing

The batch file that was written earlier when the mysql interface was debugged.

Register and start my_install.bat

@echo offset MYSQL_DIR=%~dp0rem set MYSQL_DIR=%cd%if not "%MYSQL_HOME%"=="" (    if not "%MYSQL_HOME%"=="%MYSQL_DIR%" (        echo MYSQL_HOME=%MYSQL_HOME% != MYSQL_DIR=%MYSQL_DIR%        goto my_ends    )) else (    set MYSQL_HOME=%MYSQL_DIR%    echo MYSQL_HOME must be set as MYSQL_DIR=%MYSQL_DIR%)set PATH=%MYSQL_HOME%bin;%MYSQL_HOME%lib;%PATH%mysqladmin -uroot  ping 1>nul 2>nul@if "%ERRORLEVEL%" == "0" (    echo Mysql is running.    goto my_ends)echo "MYSQL_HOME = %MYSQL_HOME%"echo Install and start mysql server ...mysqld --install mysql_srvsc config mysql_srv start= DEMANDrem sc query mysql_srvnet start mysql_srvrem sc query mysql_srvmysqladmin -uroot  ping 1>nul 2>nul@if "%ERRORLEVEL%" == "0" echo "Mysql started successfully":my_endscmd /K

Disable uninstall my_uninstall.bat

@echo offset MYSQL_DIR=%~dp0rem set MYSQL_DIR=%cd%if not "%MYSQL_HOME%"=="" (    if not "%MYSQL_HOME%"=="%MYSQL_DIR%" (        echo MYSQL_HOME=%MYSQL_HOME% != MYSQL_DIR=%MYSQL_DIR%        goto my_ends    )) else set MYSQL_HOME=%MYSQL_DIR%set PATH=%MYSQL_HOME%\bin;%MYSQL_HOME%\lib;%PATH%echo "MYSQL_HOME = %MYSQL_HOME%"echo Stop and uninstall mysql server ...mysqladmin -uroot  ping  1>nul 2>nul@if "%ERRORLEVEL%" == "0" (    net stop mysql_srv    rem sc query mysql_srv)mysqld --remove mysql_srv:my_endspause



 

 

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.