Mysql Common Commands and considerations

Source: Internet
Author: User

1. Connect to MySQL Database

If you configure an environment variable to run directly, if you do not configure the environment variable you need to run under the installation directory ... \ bin, cmd---mysql-u root-p, and then enter the password;

Or you can run cmd---Mysql-u root-p123, especially note that between you and root can have spaces or not, but there must be no space between-P and 123

2. View all the database

mysql-> show databases; Special attention to the databases can not be misspelled, after you must enter ";" then press ENTER, a statement or command at the end of the best input ";"

3. connect to MySQL on the remote host.

Assume the remote host IP is: 110.110.110.110, the user name is root, the password is abcd123. Type the following command:
Mysql-h110.110.110.110-u Root-p 123; (Note: You can not add a space between the root and the other)

4. quit MySQL Command: Exit (Enter)

5. Select Database

After show databases, you can select a database you want to manipulate and use the command databasename,databasename instead of the actual database name.

6. View all the tables in the selected database

After you select database, you can use show tables to view all the table

7. View Table Structure

Desc TableName

8. Other operations on the table are like ordinary SQL statements, which are not described in detail here first

Mysql Common Commands and considerations

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.