Detailed explanation of MySQL table name case-insensitive configuration method

Detailed explanation of MySQL table name case-insensitive configuration method

By default, MySQL in Linux distinguishes between upper and lower case table names. Whether MySQL is case sensitive is determined by the parameter lower_case_table_names, where:

1) lower_case_table_names = 0

Case-sensitive (not case sensitive), this is the default setting. After this setting, it does not matter whether the table names created in MySQL contain uppercase letters or not, they can all be read and referenced normally.

2) lower_case_table_names = 1

Case-insensitive (i.e. case sensitive). After this setting, the table names are saved in lowercase on the hard disk, and MySQL converts all table names to lowercase for storage and search. This behavior also applies to database names and table aliases .

That is to say, after MySQL is set to be case-insensitive, when creating a database or table, no matter if uppercase letters are used when creating it, it will be forced to be saved in lowercase after the creation is successful!

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

1) Database names and table names are strictly case-sensitive;

2) Table aliases are strictly case-sensitive;

3) Column names and column aliases are case-insensitive in all cases;

4) Variable names are also strictly case-sensitive;

5) MySQL is not case-sensitive under Windows, but is case-sensitive by default under Linux.

6) If you want to distinguish between uppercase and lowercase letters when querying, you need to set the BINARY attribute for the field value. There are several ways to set it:
a) Setting at creation time:
CREATE TABLE T(A VARCHAR(10) BINARY);
b) Use alter to modify

Therefore, in order to ensure that programs and databases can run normally in different operating systems, the best way is to convert them to lowercase when designing tables! !

Modify mysql to be case-insensitive:

mysqladmin -uroot -p shutdown //Shut down the database in safe mode

Modify my.cnf //Add the following line of settings
.....
[mysqld]
lower_case_table_names=1
.....

Start mysql

The above detailed explanation of the configuration method of ignoring case in MySQL table names is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Notes on MySQL case sensitivity
  • MySQL character types are case sensitive
  • How to set mysql to case insensitive
  • Analysis of problems caused by MySQL case sensitivity
  • How to solve the problem of case insensitivity in MySQL queries
  • MySQL database case sensitivity issue
  • Linux system MySQL forgotten password, reset password, ignore the case of table and column names
  • How to distinguish uppercase and lowercase letters in strings when querying MySQL
  • MySql query case insensitive solution (two)
  • MySQL table name case selection

<<:  How to use cookies to remember passwords for 7 days on the vue login page

>>:  Install Mininet from source code on Ubuntu 16.04

Recommend

MySQL database JDBC programming (Java connects to MySQL)

Table of contents 1. Basic conditions for databas...

Three ways to draw a heart shape with CSS

Below, we introduce three ways to draw heart shap...

The meaning and calculation method of QPS and TPS of MySQL database

When doing DB benchmark testing, qps and tps are ...

Solve the problem of docker container exiting immediately after starting

Recently I was looking at how Docker allows conta...

The difference between the four file extensions .html, .htm, .shtml and .shtm

Many friends who have just started to make web pag...

Example of using Dockerfile to build an nginx image

Introduction to Dockerfile Docker can automatical...

How to set up virtual directories and configure virtual paths in Tomcat 7.0

Tomcat7.0 sets virtual directory (1) Currently, o...

Implementation of CSS child element selection parent element

Usually a CSS selector selects from top to bottom...

What is Makefile in Linux? How does it work?

Run and compile your programs more efficiently wi...

JavaScript array merging case study

Method 1: var a = [1,2,3]; var b=[4,5] a = a.conc...

js to realize the rotation of web page pictures

This article shares the specific code of js to re...

Introduction to using MySQL commands to create, delete, and query indexes

MySQL database tables can create, view, rebuild a...

Vue uses the method in the reference library with source code

The official source code of monaco-editor-vue is ...

Introduction to Nginx regular expression related parameters and rules

Preface Recently, I have been helping clients con...