Record some of MySQL's database syntax
1 Change root password: mysqladmin-u root password ' 123456
1 mysql- u user name-p password go in MySQL monitor
1 , show databases; show all database names 2 11, CREATE database;
1 CREATE all privileges on test.* to [email protected] identified by ' 123456 '; --Grant all database permissions to the user
1 1, show tables -- Show all table names in the library 2 2, DESC table name--Show Table structure
1 CREATE TABLE tbl_mobile_wblist (2ID INT PRIMARY KEY auto_increment not NULL COMMENT ' ID ',3Whitemobile VARCHAR (+) DEFAULT NULL COMMENT ' White list phone number ',4Wenabled CHAR (4) DEFAULT ' 1 ' COMMENT ' Enable identity 1: Enable 0: Off ',5Blackmobile VARCHAR (+) DEFAULT NULL COMMENT ' blacklist phone number ',6Benabled CHAR (4) DEFAULT ' 1 ' COMMENT ' Enable identity 1: Enable 0: Off ',7Back VARCHAR (max) DEFAULT NULL COMMENT ' alternate field ',8Up VARCHAR (+) DEFAULT NULL COMMENT ' alternate field '9);
1 CREATE INDEX wb_index on Tbl_mobile_wblist (whitemobile); --Index creation
SHOW INDEX from Tbl_mobile_wblist; --show the index of the table
The first index is the index that is generated when the primary key is created, also known as the primary key index, and a clustered index
1 DROP INDEX wb_test on tbl_mobile_wblist; --Index deletion
1 EXPLAIN SELECT w.whitemobile from Tbl_mobile_wblist W; --View the usage of the index
1 CREATE INDEX we_test_duo on Tbl_mobile_wblist (whitemobile,blackmobile); -- Creating a composite index 2 is equivalent to creating an index for each column
1 EXPLAIN SELECT * from tbl_mobile_wblist c WHERE c.blackmobile= ' 123 ';
when the latter column of the composite index is used as a where condition, the index is not taken
MySQL Usage-Simple index