MySql  控制台查询时出现乱码

Database&Table 的字符集 于Mysql控制台显示的字符集不一样

右键单击mysql控制台边框  单击属性  查看当前代码页的字符集模式是否于数据库的字符集模式一样

查看数据库字符集 show variables like '%char%';

主要看的有:character-set-client=gbk     character-set-server=gbk    character-set-result=gbk  是否一样

解决:设置数据库字符模式

alter  database  Database_name  default character set gbk;

alter database Database_name default character set utf8 default collate utf8_geberal_ci;

collate utf8_geberal_ci : utf8  字符校对模式       gbk没找到校对,有请留言。

没效果请打开my.ini  修改 default-character-set=gbk    character-set-server=gbk

创建的时候指定:

create  database Database_name character set gbk;

页面乱码:在Dreamware 上找到页面属性  设置字符模式

如果有链接Mysql  应该保持统一

数据库+页面字符集+HTML head<meta charset=''>+Mysql于PHP链接字符(set names gbk)

在页面查询数据库获取的是乱码:Mysql ,页面字符集,mysql和PHP传输字符是否一样

设置apache的配置文件 httpd.conf  添加或修改apache 默认字符启动模式: AddDefaultchars gbk

直接设置传输字符 mysql> set names gbk

<?php  $conn=mysql_connection("localhost","root","root");

    mysql_query("set names gbk",$conn);

    mysql_close();

?>

PHP character garbled的更多相关文章

  1. ERROR 1300 (HY000): Invalid utf8 character string: ''

    在load csv 进mysql的时候,报这个错,苦恼了很长时间,网上搜索不到答案. mysql>    load data infile '/home/hdh/8_sr/8_45.csv'   ...

  2. [LeetCode] First Unique Character in a String 字符串第一个不同字符

    Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...

  3. 387. First Unique Character in a String

    Given a string, find the first non-repeating character in it and return it's index. If it doesn't ex ...

  4. mysql character set exception

    问题: 插入数据时,报了这样一个错误:“_mysql_exceptions.Warning: Incorrect string value: ‘\xE6\xB5\x81\xE8\xA1\x8C…’ f ...

  5. LeetCode 387. First Unique Character in a String

    Problem: Given a string, find the first non-repeating character in it and return it's index. If it d ...

  6. BeautifulSoup Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.

    BeautifulSoup很赞的东西 最近出现一个问题:Python 3.3 soup=BeautifulSoup(urllib.request.urlopen(url_path),"htm ...

  7. java.lang.IllegalArgumentException: Illegal character in query at index 261

    在BaseFragment中使用了LoadingPage,而LoadingPage的联网加载使用的是AsyncHttpClient.一直报java.lang.IllegalArgumentExcept ...

  8. ORA-06502:PL/SQL :numberic or value error: character string buffer too small

    今天遇到一个错误提示:ORA-06502:PL/SQL :numberic or value error: character string buffer too small,一般对应的中文信息为:O ...

  9. Character类

    Character类 用来判断大小写 方法: public static boolean isUpperCase(char ch):判断是否大写 public static boolean isLow ...

随机推荐

  1. js解决IE8、9下placeholder的兼容问题

    由于placeholder是html5的新属性,在IE8.IE9下是不能显示的,有兼容性问题. 解决思路: 1.判断目前浏览器是否支持placeholder属性 2.若不支持,则将type=" ...

  2. PhoneGap初试!

    最近公司准备开发一个移动应用,方便起见准备开发web项目,用PhoneGap打包成iOS与Android平台的应用.对PhoneGap完全不了解,所以先装个试下.折腾了大半天,总算弄出点儿眉目,整理下 ...

  3. 计算机网络(8)-----TCP报文段的首部格式

    TCP报文段的首部格式 概述 TCP报文段首部的前20个字节是固定的,因此TCP首部的最小长度是20字节. 源端口和目标端口 各占2个字节,分别写入源端口号和目的端口号. 序列号 占4个字节,表示本报 ...

  4. jsp学习之基于mvc学生管理系统的编写

    mvc开发模式:分别是 model层 view层 Control层 在学生管理系统中,model层有学生实体类,数据访问的dao层,view层主要是用于显示信息的界面,Control层主要是servl ...

  5. Maven 从svn下载后,pom.xml报错解决方案

    Multiple annotations found at this line: - Execution default-testResources of goal org.apache.maven. ...

  6. C# winform 模拟键盘鼠标操作

    1.获取鼠标位置 private void timer1_Tick(object sender, EventArgs e) { // timer1.Stop(); // int x = Control ...

  7. 在eclipse的maven插件中搜寻本地仓库中的jar搜索不到的解决方案

    在eclipse的maven插件中搜寻本地仓库中的jar搜索不到的解决方案 之前,用过maven管理项目的童鞋都知道本地会有一个${User_Home}.m2/repository仓库 是用来存放ja ...

  8. 算法导论----贪心算法,删除k个数,使剩下的数字最小

    先贴问题: 1个n位正整数a,删去其中的k位,得到一个新的正整数b,设计一个贪心算法,对给定的a和k得到最小的b: 一.我的想法:先看例子:a=5476579228:去掉4位,则位数n=10,k=4, ...

  9. Configure the max limit for concurrent TCP connections(转)

    To keep the TCP/IP stack from taking all resources on the computer, there are different parameters t ...

  10. 软件测试第四周--关于int.parse()的类型转换问题

    先来归纳一下我们用过的所有类型转换方法: 1. 隐式类型转换,即使用(int) 直接进行强制类型转换.这种方法的优点是简单粗暴,直接指定转换类型,没有任何保护措施,所以也很容易抛出异常导致程序崩溃.当 ...