Home  >  Article  >  Operation and Maintenance  >  Are mysql table names case sensitive in linux?

Are mysql table names case sensitive in linux?

WBOY
WBOYOriginal
2022-07-26 17:13:523193browse

MySQL table names in Linux are case-sensitive; MySQL database names, table names, variable names, and table aliases are all strictly case-sensitive in Linux, while column names and column aliases are all case-sensitive. Case is ignored in all cases. You can modify the "ower_case_table_names" parameter in the MySQL configuration file to set whether it is case sensitive.

Are mysql table names case sensitive in linux?

The operating environment of this tutorial: linux7.3 system, mysql8.0.22 version, Dell G3 computer.

Is the mysql table name in Linux case-sensitive?

In Linux, after the MySQL installation is completed, the table name is case-sensitive by default, and this attribute cannot be modified. It is said on the Internet in /etc/mysql The configuration of added fields in /my.cnf will not take effect, and mysql will fail to start after modification.

The table name of mysql is case-sensitive in Linux, but the table name of mysql in Windows is not case-sensitive; you can add a line "ower_case_table_names = parameters" in the MySQL configuration file "my.ini [mysqld]" to Set whether to be case sensitive.

MySQL's case rules for database names, table names, column names, and aliases under Linux are as follows:

  • There is a strict distinction between database names and table names. Case;

  • Table aliases are strictly case-sensitive;

  • Column names and column aliases are in all Case is ignored in all cases;

  • Variable names are also strictly case-sensitive;

MySQL is not case-sensitive under Windows Write.

So in order to make the program and database run normally in different operating systems, the best way is to convert them to lowercase during design. However, if the case has been normalized during design, then In the Windows environment, you only need to make changes to the database configuration.

The specific operations are as follows:

Add a line ower_case_table_names = 1# in the MySQL configuration file my.ini [mysqld]

##Parameter explanation:

  • 0: Case sensitive

  • 1: Not case sensitive

In MySQL, databases and tables correspond to the directories and files in those directories.

Therefore, the sensitivity of the operating system determines the case sensitivity of database and table naming. This means that database and table names are case-insensitive on Windows but are case-sensitive on most types of Unix systems.

Column names and column aliases are case-insensitive in all cases, and table aliases are case-sensitive. To avoid this problem, it is best to use all lowercase letters plus underscores when defining database naming rules, without using any uppercase letters. Or you can force it to start with the -O lower_case_table_names=1 parameter

Recommended learning:

Linux video tutorial

The above is the detailed content of Are mysql table names case sensitive in linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Can Linux use opencv?Next article:Can Linux use opencv?