課程
/后端開發
/PHP
/手把手教你實現電商網站后臺開發
這個表始終提示“invalid default value for "sex"”錯誤,我把defalut“保密”去掉就可以了,這是為什么昵
2015-01-23
源自:手把手教你實現電商網站后臺開發 1-2
正在回答
你數據庫的版本是多少的?
^-^...
moon_2007 提問者
伏地炸毛
出任CEO迎娶白富美
我也遇到了這個問題
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';
在代碼末尾加上charset='utf8',就可以了。我的MySQL是5.6.17版字段和表名不能加單引號。
設置下mysql的字符集,我的MYSQL是wampsever傻瓜式安裝的,默認的字符集是latin什么的,我也出現了這種情況,自己再設置下就好show variables like 'collation_%';show variables like 'character_set_%';把查出來的數據都改成UTF8或者是GBK
文翰弟
舉報
手把手教你用PHP搭建電子商務平臺,由淺入深教你搭建電商系統
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-01-23
你數據庫的版本是多少的?
^-^...
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';
在代碼末尾加上charset='utf8',就可以了。我的MySQL是5.6.17版字段和表名不能加單引號。
2015-03-23
設置下mysql的字符集,我的MYSQL是wampsever傻瓜式安裝的,默認的字符集是latin什么的,我也出現了這種情況,自己再設置下就好show variables like 'collation_%';show variables like 'character_set_%';把查出來的數據都改成UTF8或者是GBK