1. Database
1: show databases;
2:
3: use DB_NAME;
4:
5: create database DB_NAME;
6:
2. Table
1: show tables;
2:
3: Create Table table_name; // List 2
4:
5: describe TABLE_NAME ;
6:
7: select * from TABLE_NAME ;
8:
9: insert into TABLE_NAME values (’xxx’,’xxx’,’xxx’,’xxx’);
10:
11: delete from TABLE_NAME ;
12:
1: -- create database 'abc _ db '; 2: 3: Drop table if exists 'abc _ table '; 4: Create Table 'abc _ table '( 5: 'id' bigint (20) not null auto_increment, -- primary key 6: 'topic 'varchar (32) not null, 7: 'group _ id' varchar (64) not null, 8: 'md5' varchar (4000) default null 9: Primary Key ('id ') 10:) engine = InnoDB default charset = utf8;
For more information about engine = InnoDB, see here:
Http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html
3. Index
1: show index from TABLE_NAME ;
2:
3: show keys from TABLE_NAME ;
4:
5: create index INDEX_NAME on TABLE_NAME (COLUMN1, COLUMN3,…);
6:
7: drop index INDEX_NAME on TABLE_NAME;
8:
9: alter table TABLE_NAME add index INDEX_NAME (COLUMN1, COLUMN3,…);
10:
11: alter table TABLE_NAME drop index INDEX_NAME;
12:
Refer:
Http://www.chinaz.com/program/2010/0119/104365.shtml
Http://hi.baidu.com/pibuchou/blog/item/268adc33a36ab294a8018e75.html
Http://happyman-bruce.blogbus.com/logs/1740464.html
4. Others
Show processlist;
Show grants for user_name;