Use set names 'gbk' to solve the same problem between 'rat 'and 'weak '.

Source: Internet
Author: User

Http://topic.csdn.net/u/20081204/13/841fbb19-7ca0-439d-b353-e6578ac98365.html

This can be attributed to a typical character set problem. When the character sets are set to the same, no errors will occur.
See:
Mysql> show variables like 'Char % ';
+ -------------------------- + ------------------------------------------- +
| Variable_name | value |
+ -------------------------- + ------------------------------------------- +
| Character_set_client | Latin1 |
| Character_set_connection | Latin1 |
| Character_set_database | GBK |
| Character_set_results | Latin1 |
| Character_set_server | GBK |
| Character_set_system | utf8 |
| Character_sets_dir | D :\ mysql-5.0.9-beta-win32 \ share \ charsets/|
+ -------------------------- + ------------------------------------------- +
7 rows in SET (0.01 Sec)

Mysql> set names 'gbk ';
Query OK, 0 rows affected (0.00 Sec)

Mysql> show variables like 'Char % ';
+ -------------------------- + ------------------------------------------- +
| Variable_name | value |
+ -------------------------- + ------------------------------------------- +
| Character_set_client | GBK |
| Character_set_connection | GBK |
| Character_set_database | GBK |
| Character_set_results | GBK |
| Character_set_server | GBK |
| Character_set_system | utf8 |
| Character_sets_dir | D :\ mysql-5.0.9-beta-win32 \ share \ charsets/|
+ -------------------------- + ------------------------------------------- +
7 rows in SET (0.00 Sec)

Mysql> select * from A1;
+ ------ +
| Word |
+ ------ +
| Rat |
| Try |
+ ------ +
2 rows in SET (0.00 Sec)
Mysql> Delete from A1;
Query OK, 2 rows affected (0.02 Sec)

Mysql> insert into A1 values ('rat ');
Query OK, 1 row affected (0.06 Sec)

Mysql> insert into A1 values ('test ');
Query OK, 1 row affected (0.08 Sec)

Mysql> select * from A1 where WORD = 'rat ';
+ ------ +
| Word |
+ ------ +
| Rat |
+ ------ +
1 row in SET (0.01 Sec)

This will not be a problem. If you are interested, try it.
Binary like seems to be another matching method.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.