标签:
1、修改配置文件my.ini设置编码方式为utf-8
[client] default-character-set=utf8 [mysqld] character-set-server=utf8 collation-server=utf8_general_ci init_connect=’SET NAMES utf8′
重启mysql,后在命令行下输入:
show varables like “%char%”
设置完成!
2、插入中文记录时出现错误
366 - Incorrect string value: ‘\xE8\xBD\xA6\xE9\x9B\xB6...‘ for column ‘name‘ at row 1
那么就得删掉原来建的DB,重新建并制定字符集为utf8,如:
CREATE DATABASE `jay_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
3、正确中文记录显示
参考:
http://www.tuicool.com/articles/YvEZjyU
http://www.kuqin.com/database/20090406/44388.html
标签:
原文地址:http://www.cnblogs.com/ddblog/p/4384131.html