1 显示数据库     mysql->show databases;
2 创建数据库     mysql->create database db;
3 删除数据库  mysql->drop database db;
4 选择数据库     mysql->use db;        此时你已经进入你刚才所建立的数据库db
5 创建表         mysql->create table mytable(name varchar(20),sex(char(1),birth date);
6 删除表    mysql->drop table mytable;
7 显示表的内容   mysql->show tables;
8 显示表的结构   mysql->describe mytable;
9.显示MYSQL当前用户命令 mysql> select user();

-------------------------------------------------------
人工建表语句,表明student
mysql> create table student(
    -> id int(4) not null,
    -> name char(20) not null,
    -> age tinyint(2) not null default '0',
    -> dept varchar(16) default null);
Query OK, 0 rows affected (0.07 sec)
---------------------------------------
mysql 编译过的建表语句  //属性有引号,有引擎,有字符集
mysql> show create table student \G;
*************************** 1. row ***************************
       Table: student
Create Table: CREATE TABLE `student` (
  `id` int(4) NOT NULL,
  `name` char(20) NOT NULL,
  `age` tinyint(2) NOT NULL DEFAULT '0',
  `dept` varchar(16) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
-------------------------------------------------
实际工作环境中的表
create table 'subject_comment_manager'(
'subject_comment_manager_id' bigint(12) not null auto_increment comment'主键',
'subject_type' tinyint(2) not null comment'素材类型',
'subject_primary_key' varchar(255) not null comment '素材的主键',
'subject_title' varhcar(255) not null comment'素材的名称',
'edit_user_nick' varhcar(64) default null comment'修改人',
'edit_user_time' timestamp null default null comment'修改时间',
'edit_comment' varchar(255) default null comment'修改的理由',
'state' tinyint(1)not null default '1' comment '0代表关闭,1代表正常',
primary key('subject_comment_manager_id'),
key 'idx_primarykey' ('subject_primary_key(32)),
key 'idx_subject_title' ('subject_title'(32))
)engine=innodb auto_incement=1 default charset=utf8
-----------------------------------------------------------

TRUNCATE TABLE
删除表中的所有行,而不记录单个行删除操作。
语法
TRUNCATE TABLE name
参数
name
是要截断的表的名称或要删除其全部行的表的名称。
注释
TRUNCATE TABLE 在功能上与不带 WHERE 子句的 DELETE 语句相同:二者均删除表中的全部行。但 TRUNCATE TABLE 比 DELETE 速度快,且使用的系统和事务日志资源少。
DELETE 语句每次删除一行,并在事务日志中为所删除的每行记录一项。TRUNCATE TABLE 通过释放存储表数据所用的数据页来删除数据,并且只在事务日志中记录页的释放。
TRUNCATE TABLE 删除表中的所有行,但表结构及其列、约束、索引等保持不变。新行标识所用的计数值重置为该列的种子。如果想保留标识计数值,请改用 DELETE。如果要删除表定义及其数据,请使用 DROP TABLE 语句。
对于由 FOREIGN KEY 约束引用的表,不能使用 TRUNCATE TABLE,而应使用不带 WHERE 子句的 DELETE 语句。由于 TRUNCATE TABLE 不记录在日志中,所以它不能激活触发器。
TRUNCATE TABLE 不能用于参与了索引视图的表。

truncate table table_name 物理上删除表的数据
delete from table  逻辑上删除表