MySQL command line is to learn the MySQL database must master the knowledge, here is to introduce you to 10 easy-to-use MySQL command line, I hope you learn MySQL command line can help.
1, show the structure of the data table:
mysql> DESCRIBE table name; (DESC table name)
2, the establishment of data tables:
mysql> USE library name; / / Enter the database
mysql> CREATE TABLE table name (field name VARCHAR (20), field name CHAR (1));
3, delete the data sheet:
mysql> DROP TABLE table name;
4, rename the data table
alter table t1 rename t2;
5, show the record in the table:
mysql> SELECT * FROM table name;
6, insert records to the table:
mysql> INSERT INTO table name VALUES ("hyq", "M");
7, update the data in the table:
mysql-> UPDATE table name SET field name 1 = 'a', field name 2 = 'b' WHERE field name 3 = 'c';
8, empty the records in the table:
mysql> DELETE FROM table name;
9, the text data into the data table:
mysql> LOAD DATA LOCAL INFILE "D: / mysql.txt" INTO TABLE table name;
10, display the definition of the table, you can also see the constraints of the table, such as foreign keys
The above is the introduction of 10 commonly used MySQL command line.