MySQL is case sensitive. mysql is case sensitive.
Frequently encountered problems are not particularly important but depressing. For example, MySQL is case sensitive today. First, test the result.
In Linux, not on windows. There is a big difference. Note.
Figure 1 wins qianyan mysql> show create table Ac; + ------- + keys + | Table | Create Table | + ------- + keys + | Ac | create table 'ac' ('A' varchar (20) default null, 'C' varchar (20) DEFAULT NULL) ENGINE = InnoDB default charset = utf8 | + ------- + rows + 1 row in set (0.00 sec) mysql> insert into Ac values ('1q ', '1q'); Query OK, 1 row affected (0.00 sec) mysql> insert into Ac values ('1q', '1q'); Query OK, 1 row affected (0.00 sec) mysql> select * from Ac WHERE a = '1q'; + ----- -+ ------ + | A | c | + ------ + | 1q | 1q | 1Q | 1Q | + ------ + 2 rows in set (0.00 sec) mysql> select * from AC; ERROR 1146 (42S02): Table 'test. AC 'doesn' t existmysql> select * from Ac where A = '1q '; + ------ + | a | c | + ------ + | 1q | 1q | 1Q | 1Q | + ------ + 2 rows in set (0.00 sec) the above results reflect the following conclusions. In Linux, the database name, table name, column name, And alias are case sensitive: 1. The database name and table name are case sensitive; 2. Table aliases are case sensitive;
3. The column name and column alias are case-insensitive in all cases; 4. The field content is case-insensitive by default. The case sensitivity of database names and table names in mysql is controlled by the lower_case_table_names parameter. If the value is 0, it indicates case sensitivity. If the value is 1, it indicates that the name is converted to lower-case and stored without case sensitivity. Mysql> show variables like '% case % '; + rows + ------- + | Variable_name | Value | + ------------------------ + ------- + | lower_case_file_system | OFF | lower_case_table_names | 0 | + rows + ------- + 2 rows in set (0.00 sec) when modifying the cnf configuration file or compiling, restart the service.
The fields stored in MySQL are case-insensitive. This is incredible. Especially when a user registers a business, a joke may occur. Therefore, it is better to strictly limit the case sensitivity.
How to Avoid case sensitivity of field content. It is the validation rule for adding fields.
By default, the field content is case-insensitive. Case Insensitive.
Mysql> create table aa (a varchar (20)
BINARY, C varchar (20); Query OK, 0 rows affected (0.10 sec) mysql> show create table aa; + ------- + tables ---------------------------- + | Table | Create Table | + ------- + tables -------------------------------- + | aa | create table 'A' ('A' varchar (20)
Character set utf8 COLLATE utf8_bin default null,'C' varchar (20) default null) ENGINE = InnoDB default charset = utf8 | + ------- + response -------------------------------- + 1 row in set (0.00 sec) mysql> select * from aa; + ------ + | a | c | + ------ + | a | C | A | c | + ------ + 3 rows in set (0.00 sec) mysql> select * from aa where a = 'a '; + ------ + | a | c | + ------ + | a | C | + ------ + 2 rows in set (0.00 sec) mysql> select * from aa where a = 'a '; + ------ + | a | c | + ------ + | A | c | + ------ + 1 row in set (0.00 sec) for the following reasons: the field value is case sensitive
Mysql checking rules to control. When it comes to proofreading rules, you have to talk about character sets. Character Set is a set of symbols and encoding. The collation is a set of rules used to compare characters in the character set. generally, the proofreading rules start with the relevant Character Set names. Generally, they contain a language name and are case-insensitive (_ ci), and _ cs (case-sensitive) or _ bin (Binary) ends. For example, the utf8_general_ci character set is not case sensitive. This is the default verification rule for the utf8_general_cs character set. The utf8_bin character set is case sensitive and the utf8_bin character set is case sensitive. Record!