Home > Database > Mysql Tutorial > body text

MySQL 5.0.16乱码问题的解决方法_MySQL

WBOY
Release: 2016-05-30 17:10:28
Original
1241 people have browsed it

怎样解决MySQL 5 0 16的乱码问题? 本文给出了解决方法:
问:怎样解决MySQL 5.0.16的乱码问题?
答:MySQL 5.0.16的乱码问题可以用下面的方法解决:
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 ;
Copy after login

4.检查表结构中
varchar(100) 的整理属性为gbk_chinese_ci
其它类型的整理属性为空。
5.代码中加上

$db->query("SET CHARACTER SET GBK"); 
Copy after login

Linux下需要,Windows下则不需要。
此种操作相当于Connection Character Sets and Collations

本文给出解决方法很简单,但是实际操作过程中要视情况而定,具体问题具体分析嘛,还是希望这篇文章或多或少可以帮助到大家。

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template