Home > Database > Mysql Tutorial > mysql中文排序注意事项与实现方法

mysql中文排序注意事项与实现方法

WBOY
Release: 2016-06-07 18:00:39
Original
978 people have browsed it

mysql在查询字符串时是大小写不敏感的,在编绎mysql时一般以ISO-8859字符集作为默认的字符集,因此在比较过程中中文编码字符大小写转换造成了这种现象,比较应急的方法是对于包含中文的字段加上binary属性,使之作二进制比较

mysql中文排序方法1
mysql在查询字符串时是大小写不敏感的,在编绎mysql时一般以ISO-8859字符集作为默认的字符集,因此在比较过程中中文编码字符大小写转换造成了这种现象,比较应急的方法是对于包含中文的字段加上"binary"属性,使之作二进制比较,
例如将"name char(10)"改成"name char(10)binary"."
(已试验成功)

mysql中文排序方法2
编译mysql时使用--with--charset=gbk
(未测试)
Related labels:
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