建立表时使用show create table student
查看发现编码默认为latin1
接下来使用alter table student default character set utf8;
更改了数据表的编码方式。
发现表的编码已经改为utf8,但是表中字段还是latin1,对于性别字段仍写入汉字仍报错。
接下来更改字段的编码方式
alter table student convert to character set utf8;
这样应该就可以了吧,但是发现又出现了小错误。
check the manual that corresponds to your MySQL server version for the right syntax to use near 'utf8' at line 1