The like problem of mysql is very powerful !!!. Method 1: Add the binary attribute to a field that contains Chinese characters for binary comparison. for example, change namechar (10) to namechar (10) binary. Method 2: If you use Method 1:
The solution is to add the "binary" attribute to a field that contains Chinese characters for binary comparison. for example, change "name char (10)" to "name char (10) binary ".
Method 2:
If you use the source code to compile MySQL, you can use the -- with -- charset = gbk parameter when compiling MySQL, so that MySQL can directly support Chinese searching and sorting.
Method 3:
You can use the locate function of Mysql to determine. The preceding problem is used as an example:
SELECT * FROM table WHERE locate (field, 'Lil')> 0;
Method 4:
Change your Select statement to this way. SELECT * from table where fields like binary '% FIND % '.
The cause of the problem is that the sorting and search results of Chinese characters are incorrect in MySQL. This situation exists in many MySQL versions. If this problem is not solved, MySQL cannot actually process Chinese characters.
The cause of this problem is: MySQL is case insensitive when querying strings, in programming MySQL, the ISO-8859 character set is generally used as the default character set, therefore, the case-sensitivity conversion of Chinese encoding characters during the comparison process causes this phenomenon.
The alias solution is to add the "binary" attribute to a field that contains Chinese characters for binary comparison. for example, change "namechar (10)" to "namechar (10) binary ". Method 2: If you use...