初学mysql我也碰到中文存储的问题,以下是我的解决方案:
1.首先在字段选项column option 中将字段字符集column charset设为gb2312。
2.还需要在表选项table option 中同样将charset设置为gb2312.
3.最后如果还不行,就在mysql安装目录下找到my.ini,找到以下位置:
[mysql]
default-character-set=gb2312
同样将character-set设为gb2312.
经过以上设置就可以在mysql中保存中文了。
如果还是不行,还有一招,就是连接时指定字符集:jdbc:mysql://localhost:3306/test?useunicode=true&characterEncoding=utf8
注意这里的“&”代表"&"字符