Rumah  >  Artikel  >  pangkalan data  >  mac下批改mysql的默认字符集为utf8

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

WBOY
WBOYasal
2016-06-07 16:26:341385semak imbas

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/ |
+--------------------------+-------------------------------------------------------------+
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn