MySQL content is not case sensitive?

Scenes

The varchar type string stored in the database is not case sensitive when querying.

Insert picture description here

In short: by show variables like 'lower_case_table_names'viewing value, 0 represents the strict distinction, a representative does not distinguish,

By modifying the configuration my.cnffile of mysql and restarting, the desired effect can be achieved.

1. By default, mysql is case-sensitive for bai. Use dushow Variables like'%table_names' to view the value of lower_case_table_names. 0 means distinction, and 1 means no distinction.

2. zhimysql is not case sensitive by default for daovarchar data, but if the field is encoded with "*_bin", it will make mysql case sensitive.

3. MySQL's strategy for field names is the same as varchar type data. That is: the default is not case-sensitive, but if the field is encoded with "*_bin", mysql will make it case-sensitive.

4. MySQL's strategy for table names is the same as varchar type data. That is: the default is not case-sensitive, but if the table is encoded with "*_bin", mysql will make it case-sensitive.

5. If you check that the value of lower_case_table_names is 0 according to the first item, but you need to make mysql case-insensitive by default, you need to add parameters in the mysql configuration file and restart the mysql database. The modified content of the mysql configuration file is as follows:
[mysqld]

lower_case_table_names = 1

6. Note: The encoding of tables and fields should inherit the encoding of the database as far as possible (inherited if it is not clearly specified), so as not to cause confusion.
MYSQL under LINUX needs to distinguish between uppercase and lowercase of table names by default, while table names in windows are not case sensitive.   The
  way to make MYSQL not distinguish between uppercase and lowercase of table names is actually very simple:
  1. Log in with ROOT and modify /etc/my. cnf
  2. Add a line under [mysqld]: lower_case_table_names=1

Guess you like

Origin blog.csdn.net/cainiao1412/article/details/109992212