更改MySQL的默認字符集方法集錦
方法1、 用 SET 語法來指定,不加 “GLOBAL” 的話就只對本次會話有效
www.2cto.com
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′;
www.2cto.com
方法3、 直接修改 my.ini,增加一行內容,然後重啟 MySQL,使之全局生效
default-character-set = utf8