Start MySQL command line tool with Batch Processing

Source: Internet
Author: User

Recently I am reading MySQL. After installation, every time I start the MySQL command line tool in the Start menu, I directly use the root user to connect to my local database.

Enter the password to start work. To connect to MySQL on the server, run MySQL -- h172.18.1.22-uroot-p123456 in CMD.

Every input is naturally annoying. to solve this problem by batch processing, first go to the Code:

---------------

@ Echo off
Set/p var = "Click 1 for local MySQL connection, press 2 for Link 172.18.1.22, and press 0 for Exit :"
If % VAR % = 1 GOTO Local
If % VAR % = 2 GOTO Server22

If % VAR % = 0 GOTO End

: Local
Start "Local" "D: ProgramMySQLinMySQL.exe"-uroot-p123456
Goto End

: Server22

Start "Server23" "D: ProgramMySQLinMySQL.exe"-h172.18.1.22-uroot-p123456

Goto End
: End

-----------------------

In this batch process, we first use the wait keyboard input to control the process. In this example, enter 1, 2, and 0 to control the process. Other cases are not processed.

Enter 1 and press Enter. The Code will start the exe file according to your input. In this example, the file contains parameters.

This Console appears. Here we will explain that this console is newly opened and has been closed before, because it is useless to me. If you want to use it again, use the end label for control.

Although MySQL has many powerful GUI tools, I still want to go to the console sometimes because I was not familiar with writing batch processing to call parameters in exe files, I tried several forms to find that the simplest one is correct ...... All the new ones that contribute the code to me.

 

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.