10 common MySQL command lines

Source: Internet
Author: User
Tags table definition mysql command line

MySQL command line is a must-have knowledge to learn MySQL databases. The following describes 10 useful MySQL command lines. I hope it will help you learn MySQL command lines.

1. display the data table structure:
Mysql> DESCRIBE table name; DESC table name)

2. Create a data table:
Mysql> USE Database Name; // enter the database
Mysql> create table Name (field name VARCHAR (20), field name CHAR (1 ));

3. delete a data table:
Mysql> drop table name;

4. rename a data table
Alter table t1 rename t2;

5. display the records in the table:
Mysql> SELECT * FROM table name;

6. insert records into the table:
Mysql> insert into table name VALUES ("hyq", "M ");

7. Update table data:
Mysql-> UPDATE table name: SET field name: 1 = 'a'; field name: 2 = 'B' WHERE field name: 3 = 'C ';

8. Clear records in the table:
Mysql> delete from table name;

9. load data into a data table in text mode:
Mysql> load data local infile "D:/mysql.txt" into table name;

10. display the table definition. You can also see the table constraints, such as foreign keys.

The above is an introduction to 10 commonly used MySQL command lines.

Add new users through MySQL Command Line

Differences between MySQL Hash indexes and B-Tree indexes

MySQL permission table Introduction

Statements that grant MySQL user permissions

Provides you with an in-depth understanding of MySQL permission management.

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.