Get the App
SLTechnology News&Howtos  ›  Database  › 

Example Analysis of case-insensitive processing of MySQL Database tables

Shulou Source: shulou.com Published: 2022-05-31 13:18:22 09月27日 Update

This article shows you an example analysis of the case-insensitive processing of MySQL database tables, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Case-sensitive control of MySQL

Mysql controls case sensitivity through the lower_case_table_names parameter.

1: parameter meaning

Lower_case_table_names: this parameter cannot be modified dynamically, and the database must be restarted.

Lower_case_table_names = 1 table names are stored in lowercase on disk, but are case-insensitive when compared

Lower_case_table_names=0 table names are stored as given sizes and comparisons are case-sensitive

Lower_case_table_names=2, the table name is stored in the given case but compared in lowercase

2 case-sensitive rules

Under linux:

Database names and table names are strictly case-sensitive

Aliases for tables are strictly case sensitive

Column names and column aliases are case ignored in all cases

Variable names are also strictly case-sensitive

Under windows:

Are not case-sensitive.

Under Mac OS (non-UFS volume):

Are not case-sensitive.

Case list:

Edu_website_ images table exists in the database

Select * from edu_website_images

The error does not exist through uppercase query.

Select * from EDU_WEBSITE_IMAGES

How to deal with it?

Configure mysql Profil

Vi / etc/my.cnf join a line lower_case_table_names = 1

/ / restart mysqlservice mysql restart

And then

Show variables like'% lower%'

It is possible that it turns out that the above has not been changed.

Let's export the database and recreate the database and the result will be correct.

The above is an example analysis of the case-insensitive processing of MySQL database tables. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Size data database parameters storage examples analysis processing content aliases lowercase skills time knowledge results control configuration concise concise one line Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Huawei MySQL Apple Docker