提示invalid default value for 'sex'
MySQL是5.6.17版本
drop table if exists imooc_user;//imooc_user家單引號時運行錯誤,必須去除單引號,下面一樣
create table imooc_user(
id int unsigned auto_increment key,
username varchar(20) not null unique,
passworld char(32) not null,
sex enum("男","女","保密") not null default "保密",
face varchar(50) not null,
regTime int unsigned not null
);
運行時提示:invalid default value for 'sex'(sex默認值錯誤)
我把雙引號換成單引號還是提示同樣的錯誤
2016-08-25
我也發現了 后面加個charset='utf8'就行了
2016-04-22
找到方法了 但是不明白原因
create table imooc_user(
id int unsigned auto_increment key,
username varchar(20) not null unique,
passworld char(32) not null,
sex enum("男","女","保密") not null default "保密",
face varchar(50) not null,
regTime int unsigned not null
)charset='utf8';
這樣就可以解決問題