易截截图软件、单文件、免安装、纯绿色、仅160KB

MySQL 中文显示乱码

最近关于中文显示乱码的贴子比较多,所以也做了个总结:
可以参考一下杨涛涛版主的《各种乱码问题汇总》
http://topic.csdn.net/u/20071124/08/3b7eae69-ed1d-4a77-8895-9930bf3601af.html
MySQL字符集的原理介绍。摘录于官方文档。http://dev.mysql.com/doc/refman/5.1/zh/charset.html
不同的编码格式会导致同一字符,在不同字符集下的编码会不同。同样同一编码在不同的字符集中代码的字符也不相同。当你的MySQL返回的字符串的编码格式(字符集)与你的客户工具程序(mysql, php, query browser, ...)当前使用的字符集不同时,就会造成乱码。 比如一个英国朋友告诉你Long, 当一位中国小学生看到后就会告诉你“龙”而不是“长”
关于字符集的详细介绍和例子,建议花一点时间看一下
http://dev.mysql.com/doc/refman/5.1/zh/charset.html  (第10章:字符集支持)。
这里仅摘要一下。
MySQL中默认字符集的设置有四级:服务器级,数据库级,表级 。最终是字段级 的字符集设置。注意前三种均为默认设置,并不代码你的字段最终会使用这个字符集设置。所以我们建议要用show create table table ; 或show full fields from tableName; 来检查当前表中字段的字符集设置。
MySQL中关于连接环境的字符集设置有  Client端,connection, results 通过这些参数,MySQL就知道你的客户端工具用的是什么字符集,结果集应该是什么字符集。这样MySQL就会做必要的翻译,一旦这些参数有误,自然会导致字符串在转输过程中的转换错误。基本上99%的乱码由些造成。
乱码后需要检查的信息。(如果需要论坛上的朋友帮助,建议你提供以下信息 )
1. 数据库表中字段的字符集设置 。show create table TableName 或 show full columns from tableName
mysql> show create table t1;
+-------+------------------------------------
| Table | Create Table                      
+-------+------------------------------------
| t1    | CREATE TABLE `t1` (
  `id` int(11) NOT NULL,
  `c1` varchar(30) DEFAULT NULL,
  PRIMARY KEY (`id`)   
) ENGINE=InnoDB DEFAULT CHARSET=gbk |
+-------+------------------------------------
1 row in se


相关文档:

MySQL Cluster Overview


MySQL Cluster
is a technology that enables
clustering of in-memory databases in a shared-nothing system. The
shared-nothing architecture allows the system to work with very
inexpensive hardware, and with a minimum of specific requirements
for hardware or software.

......

mysql 备份练习

<?php
$db_name="new";
mysql_connect("localhost","root","123456");
mysql_select_db($db_name);
$tb=mysql_list_tables($db_name);
$sql="";
while($query=mysql_fetch_row($tb)){
 $sql="";$table_sql="";
    $sql.= get_table_fn($query[0]);
    get_table_row($que ......

mysql 阿拉伯数字转换中文函数

CREATE DEFINER=`root`@`%` FUNCTION `sp_cn`(n_LowerMoney  decimal(15,2)) RETURNS varchar(200) CHARSET utf8
begin
Declare v_LowerStr  VARCHAR(200) ;
Declare v_UpperPart VARCHAR(200) ;
Declare v_UpperStr VARCHAR(200) ;
Declare i_I int ;
set v_LowerStr = LTRIM(RTRIM(ROUND(n_LowerMoney,2 ......

MYSQL引擎简单对比

服务器业务类型对比 性能瓶颈
DB                   I/O磁盘
转发服务器         网卡PPS
动态WEB前台         CPU
静态WEB前台   ......

Mysql的DBHelper.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;
namespace i_salesDAL
{
public class DBHelper
{
//引导数据库连接数据库调用Web.Config文件
private static MySqlConnection connection;
//创建 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号