Home  >  Article  >  Database  >  MySQL 5 乱码问题处理办法_MySQL

MySQL 5 乱码问题处理办法_MySQL

WBOY
WBOYOriginal
2016-06-01 13:47:36751browse

bitsCN.com

1 设置phpMyAdmin

Language:Chinese simplified (zh-utf-8)

MySQL 字符集:UTF-8 Unicode (utf8)

MySQL 连接校对:gbk_chinese_ci

2 创建数据库时

整理设置成 gbk_chinese_ci

3 用SQL建立表中

ENGINE=MyISAM DEFAULT CHARSET=gbk;
ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=40 ;

4 检查表结构中

varchar(100) 的整理属性为gbk_chinese_ci
其它类型的整理属性为空

5 代码中加上

$db->query("SET CHARACTER SET GBK");  Linux下需要,Windows下不需要
这个相当于Connection Character Sets and Collations

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn