Create Table: CREATE TABLE `RecruitmentDesc` ( `sn` int(11) NOT NULL AUTO_INCREMENT COMMENT '編號(自增字段)', `areaSn` int(11) NOT NULL COMMENT '地區編號', `title` varchar(50) NOT NULL COMMENT '職位標題', `content` text NOT NULL COMMENT '職位描述', `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '狀態 1可用 2不可用', `personNum` int(11) NOT NULL DEFAULT '0' COMMENT '招聘人數 0-若干', `actionTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '啓用時間', `dueTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '到期時間', `createTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '建立時間', `updateTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '更新時間', PRIMARY KEY (`sn`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='誠聘英才表' 1 row in set (0.00 sec) mysql> ALTER TABLE `RecruitmentDesc` MODIFY COLUMN `status` TINYINT NOT NULL DEFAULT 2 COMMENT '狀態 1可用 2不可用'; ERROR 1067 (42000): Invalid default value for 'dueTime' Create Table: CREATE TABLE `RecruitmentDesc111` ( `sn` int(11) NOT NULL AUTO_INCREMENT COMMENT '編號(自增字段)', `areaSn` int(11) NOT NULL COMMENT '地區編號', `title` varchar(50) NOT NULL COMMENT '職位標題', `content` text NOT NULL COMMENT '職位描述', `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '狀態 1可用 2不可用', `personNum` int(11) NOT NULL DEFAULT '0' COMMENT '招聘人數 0-若干', `actionTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '啓用時間', `dueTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '到期時間', `createTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '建立時間', `updateTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '更新時間', PRIMARY KEY (`sn`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='誠聘英才表 tinyint 從 0 到 255 的整型數據。存儲大小爲 1 字節。 ALTER TABLE `RecruitmentDesc` MODIFY COLUMN `dueTime` timestamp NOT NULL DEFAULT '2016-03-23 00:00:00' , MODIFY COLUMN `createTime` timestamp NOT NULL DEFAULT '2016-03-23 00:00:00' , MODIFY COLUMN `updateTime` timestamp NOT NULL DEFAULT '2016-03-23 00:00:00' ; ALTER TABLE `RecruitmentDesc` MODIFY COLUMN `dueTime` timestamp NOT NULL DEFAULT now() , MODIFY COLUMN `createTime` timestamp NOT NULL DEFAULT now() , MODIFY COLUMN `updateTime` timestamp NOT NULL DEFAULT now() ; create table test100(id TINYINT,dueTime NOT NULL DEFAULT now()); mysql> desc test100 -> ; +---------+------------+------+-----+-------------------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+------------+------+-----+-------------------+-------+ | id | tinyint(4) | YES | | NULL | | | dueTime | timestamp | NO | | CURRENT_TIMESTAMP | | +---------+------------+------+-----+-------------------+-------+ 2 rows in set (0.00 sec) mysql> select * from test100; Empty set (0.00 sec) mysql> insert into test100 values(1, default); Query OK, 1 row affected (0.03 sec) mysql> select * from test100; +------+---------------------+ | id | dueTime | +------+---------------------+ | 1 | 2016-03-23 17:37:19 | +------+---------------------+ 1 row in set (0.00 sec) mysql> insert into test100(id) values(20); Query OK, 1 row affected (0.01 sec) mysql> select * from test00; ERROR 1146 (42S02): Table 'zjzc.test00' doesn't exist mysql> select * from test100; +------+---------------------+ | id | dueTime | +------+---------------------+ | 1 | 2016-03-23 17:37:19 | | 20 | 2016-03-23 17:38:24 | +------+---------------------+ 2 rows in set (0.00 sec)