mysql5.5 以上的版本设置mysql字符集为utf-8
[client]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
注意,如果修改后不能启动报错,把[mysqld]段下default-character-set=utf8改为character_set_server=utf8,取消[client]段的设置。
创建数据库通用命令:
Create DATABASE IF NOT EXISTS mydata default charset utf8 COLLATE utf8_general_ci;