mysql如何修改uft8,完美支持中文

来源:互联网 发布:linux在线安装jdk1.7 编辑:程序博客网 时间:2024/04/29 15:02

如果我们是用zip 的方式安装的,那么我们没有my.ini,官方文档的说法是复制my.default.ini为my.ini,然后我们可以配置my.ini.官方的说法如下

On Windows, MySQL Installer interacts with the user and creates a file named my.ini in the base installation directory as the default option file. If you install on Windows from a Zip archive, you can copy the my-default.initemplate file in the base installation directory to my.ini and use the latter as the default option file.

http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html


然后我们可以这样配置,首先把

basedir = C:\server\mysql
datadir = C:\server\mysql\data

这两项写好,

然后在[mysqld]一栏下面添加

default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci


之后再在文件最后面添加

[client]
default-character-set=utf8

最后重新启动mysql,

填入以下命令查看

show variables like "%char%";

这是原先的:


这是后来的:

后来的图没了,下次传一下,就是除了database和dir外所有的都是utf8了




1 0