在用grails做第一个测试系统的时候遇到了中文乱码问题,本以为是grails的问题,从网上找了找才发现是mysql的问题。。 。
解决方法是:修改mysql安装路径下的my.ini文件
# CLIENT SECTION # ---------------------------------------------------------------------- # # The following options will be read by MySQL client applications. # Note that only client applications shipped by MySQL are guaranteed # to read this section. If you want your own MySQL client program to # honor these values, you need to specify it as an option during the # MySQL client library initialization. # [client] port=3306 [mysql] default-character-set=gbk
# The default character set that will be used when a new schema or table is # created and no character set is defined default-character-set=gbk
然后把已建立的表都删除,让grails重新生成,就OK了。