Common sentences in mysqld/mariadb
Create database if not exists hidb; # create a library if the library does not exist
Show warnings; # View the most recent db alarm
Alter database hidb character set 'utf-8'; # sets the database character set
Drop database testdb; # deleting a library
Show databases like'% db'; # queries database information ending in db
Help show databases; # help
Create table tbl2 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY,name VARCHAR (60) NOT NULL); # create a table structure
Create table tbl2 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR (60) NOT NULL,UNIQUE KEY (id,name)); # create table structure
Help desc; # help
Describe city; # query table structure
DESC tbl2; # query table structure
Show engines; # View supported engines
Show table status; # View all table status information
Show table status like 'tablename'\ G; # View single table status information
Show table status where name like 'table'; # View tables that start with table
Show table status where Engine='MyISAM'; # query engine is the table status of MyISAM
Alter table tbl3 ADD gender ENUM ('Fleming recently added M'); # modify the table structure and add enumerated fields
Alter table tbl3 CHANGE id stuid SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY; # modify the field name id to stuid
Alter table tbl3 ADD INDEX (name); # create index
Show INDEXES from tbl3; # View all indexes in the table
Alter table tbl3 drop index id; # Delete the index of the id field
Alter table tbl3 drop primary key id; # Delete the primary key of the id field
Create table tbl4 like mysql.user; # create the tbl4 table and copy the table structure from mysql.user
Create table tbl5 select host,user,passwd from mysql.user; # queries the fields and contents of the mysql.user table and puts them in the newly created table
Create index indexname on tabl5 (id); # create index