解析:MySQL 5.0.16乱码问题的解决方法

来源:互联网 发布:经典英文歌知乎 编辑:程序博客网 时间:2024/06/02 03:35
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
 

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 ;

4 检查表结构中

varchar(100) 的整理属性为gbk_chinese_ci

其它类型的整理属性为空。

5 代码中加上

$db->query("SET CHARACTER SET GBK"); Linux下需要,Windows下则不需要。

此种操作相当于Connection Character Sets and Collations <script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击