bitsCN.com
更改MySQL的默认字符集方法集锦
方法1、 用 SET 语法来指定,不加 “GLOBAL” 的话就只对本次会话有效
SET [GLOBAL] character_set_client = utf8;
SET [GLOBAL] character_set_connection = utf8;
SET [GLOBAL] character_set_database = utf8;
SET [GLOBAL] character_set_results = utf8;
SET [GLOBAL] character_set_server = utf8;
方法2、 也用SET语法,只对本次会话有效
SET NAMES ‘utf8′;
方法3、 直接修改 my.ini,增加一行内容,然后重启 MySQL,使之全局生效
default-character-set = utf8