首页  >  文章  >  数据库  >  mac下批改mysql的默认字符集为utf8

mac下批改mysql的默认字符集为utf8

WBOY
WBOY原创
2016-06-07 16:26:341381浏览

mac下修改mysql的默认字符集为utf8 1.在/usr/local/mysql/support-files下[目录因人而异],找到下列文件 my-huge.cnf my-large.cnf my-small.cnf ... 这是配置文件模板,copy到/etc/my.cnf,就可以使用这个配置文件 2.在[client]部分加入: default-character-se

mac下修改mysql的默认字符集为utf8
1.在/usr/local/mysql/support-files下[目录因人而异],找到下列文件
my-huge.cnf
my-large.cnf
my-small.cnf
...
这是配置文件模板,copy到/etc/my.cnf,就可以使用这个配置文件

2.在[client]部分加入:
default-character-set=utf8
在[mysqld]部分加入:
character-set-server=utf8

重启服务器,启动mysql
SHOW VARIABLES LIKE 'character_set_%';
应该能看到下列结果
+--------------------------+-------------------------------------------------------------+
| Variable_name            | Value                                                       |
+--------------------------+-------------------------------------------------------------+
| character_set_client     | utf8                                                        |
| character_set_connection | utf8                                                        |
| character_set_database   | utf8                                                        |
| character_set_filesystem | binary                                                      |
| character_set_results    | utf8                                                        |
| character_set_server     | utf8                                                        |
| character_set_system     | utf8                                                        |
| character_sets_dir       | /usr/local/mysql-5.0.51a-osx10.4-i686/share/mysql/charsets/ |
+--------------------------+-------------------------------------------------------------+
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn