创建表时添加表约束 create table table_name ( id int primary key auto_increment, actionTime datetime default current_timestamp); // 添加默认时间 为当前的表中的字段添加默认约束 alter table table_name modify actionTime datetime default current_timestamp;