Why is my MySQL not support Chinese queries?
Q: I am writing a query condition as follows: If I want to write all the records containing "Li" word $ str = "李"; select * from table where field Like '% $ STR%'; display In addition to the records containing the "Lee" word, there is a record of the "Lee" word. why? A: In MySQL, when you are sorted and finding, the resulting sequence and lookup results of Chinese characters are erroneous. This situation exists in many versions of MySQL. If this problem does not resolve, then mysql will not actually handle Chinese. The reason for this problem is that mysql is not sensitive when querying strings, generally in the ISO-8859 character set as the default character set when finishing MySQL, so Chinese coding characters case-sensitive conversion This phenomenon. Method 1: The solution is to add "binary" attributes for the "binary" attribute, such as binary comparisons, for example, "Name Char (10) binary". Method 2: If you use the source code to compile mysql, use the --with - charset = GBK parameters when you can compile MYSQL, so mysql will directly support Chinese findings and sort. Method 3: You can use the mysql Locate function to determine. Take the above problem, the method is: select * from table where locate (field, '李')> 0; this site is this method, it feels good. : P Method 4: Change your SELECT statement to this, select * from table where fields like binary '% FIND%'!