1. 資料庫
1: show databases;
2:
3: use DB_NAME;
4:
5: create database DB_NAME;
6:
2. 表
1: show tables;
2:
3: create table TABLE_NAME ; //清單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, -- 主鍵 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;
關於ENGINE=InnoDB,請參看這裡:
http://dev.mysql.com/doc/refman/5.1/zh/storage-engines.html
3. 索引
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:
參考:
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. 其它
show processlist;
show grants for USER_NAME;