Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the impact of mysql database case?

Shulou Source: shulou.com Published: 2022-05-31 19:14:34 10月21日 Update

This article mainly explains "mysql database case has what effect," interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "what is the impact of mysql database case"!

What are the effects of mysql database case?

Note: Although database and table names are case-insensitive in Windows, you should not use different case numbers to refer to a given database and table in the same query. The following query will not work because it references a table with my_table and MY_TABLE:

mysql>SELECT*FROMmy_tableWHEREMY_TABLE.col=1;

Column names and column aliases are case-insensitive in all cases.

Table aliases are case-sensitive. The following query will not work because it references aliases with a and A:

mysql>SELECTcol_nameFROMtbl_nameASaWHEREa.col_name=1ORA.col_name=2;

If you have trouble remembering the upper and lower case of database and table names, it is recommended that you adopt a consistent convention, such as always creating databases and tables in lowercase letters.

What are the effects of mysql database case?

Another way to avoid this problem is to start mysqld with-Olower_case_table_names=1. By default this option is 1 in Windows and 0 in Unix.

If lower_case_table_names is 1, MySQL will convert all table names to lowercase word lines during store and lookup. (Starting with MySQL 4.0.2, this option also applies to database names.) Note that when you change this option, you must first convert the old table names to lowercase letters before launching mysqld.

$pwd

/data1/etl/aiinsight/ScheduleServer/mysql/support-files

$./ mysql.serverstop

$pwd

/data1/etl/aiinsight/ScheduleServer/mysql/bin

./ mysqld_safe--lower_case_table_names

Method 2: Modify the my.cnf profile

Add under [mysqld]

lower_case_table_names=1

At this point, I believe that everyone has a deeper understanding of "mysql database case has what impact," may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Size data database influence query alias letter content lowercase method face study work different practical deeper consistent difficult interest method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi NVidia Xiaomi Shulou Information macOS