MySQL "Second" basic command

Source: Internet
Author: User
One, connect MySQL

There are two ways of logging in to MySQL:

  • Remote host: Mysql-h host address-u user name-p password-p port number
  • Native: mysql-h host address-u user name-p password-p port number

If the port number is 3306 (the default port number for MySQL), the-p parameter can be omitted.

The mysql> prompt indicates that the login was successful and entered MySQL's interactive operation mode.

Second, quit the MySQL operator interface

Way One:

Enter quit at the mysql> prompt, which exits the interactive interface:

Way two:

Press ctrl-d at the mysql> prompt to exit the interactive interface

Way three:

Press CTRL-C at the mysql> prompt to exit the interactive interface

Third, the first order

1. Check MySQL version number and current time

2. Arithmetic calculation

3. Specify alias as result

Four, multi-line statements

A command can be divided into multiple lines of input until it appears to be good ";" So far:

Five or one-line multi-command

Separate multiple commands in one line with semicolons

Vi. displaying the currently existing database

Vii. Select a database and display the currently selected database

Select Database

Show current Database

Viii. Cancellation of Orders

When the input command is wrong and cannot be moved (multi-line statement case), you can cancel the command as long as you enter \c before entering the semicolon:

MySQL "Second" basic command

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.