首頁  >  文章  >  資料庫  >  mac下批改mysql的默认字符集为utf8

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

WBOY
WBOY原創
2016-06-07 16:26:341382瀏覽

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