当前位置:Gxlcms > mysql > mac下批改mysql的默认字符集为utf8

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

时间:2021-07-01 10:21:17 帮助过:17人阅读

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/ |
+--------------------------+-------------------------------------------------------------+

人气教程排行