MySQL like problem, super strong kill Remember!!! _php Tips
Source: Internet
Author: User
Method One:
The workaround is to add the "binary" attribute to the field containing Chinese as a binary comparison, such as changing "name char (10)" to "name char" binary.
Method Two:
If you use the source code to compile MySQL, you can compile MySQL using the--WITH--CHARSET=GBK parameters, so that MySQL will directly support Chinese search and sorting.
Method Three:
You can use the Mysql locate function to determine. Take the above questions for example, using the following methods:
SELECT * FROM table WHERE locate (field, ' Lee ') > 0;
Method Four:
Change your SELECT statement to this, select * from TABLE WHERE FIELDS like BINARY '%find% '
The problem arises because: in MySQL, in the Chinese sorting and search, the Chinese character sorting and search results are wrong. This situation exists in many versions of MySQL. If this problem is not resolved, then MySQL will not be able to actually handle Chinese.
The reason for this problem is: MySQL in the query string is not sensitive to the case, when compiling the MySQL in general with the ISO-8859 character set as the default character set, so in the comparison process of Chinese encoded character case conversion caused this phenomenon
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service