How does MySQL database set table name case insensitivity?

Source: Internet
Author: User

Turn from: 8313839

In cross-platform programming, it is important to note that some of MySQL's system variables have different defaults on Windows and Linux, such as the case variables for MySQL table names.

The default value for the Lower_case_table_names variable on Windows is 1, 0 on Linux, and 2 on Mac OS;

The value of the variable is defined in detail as follows:

Value meaning
0 Table and database names is stored on disk using the Lette Rcase specified in The create TABLE  or create DATABASE  statement. Name comparisons is case sensitive. You should  not  set This variable to 0 if you are running MySQL on a system that has case-insensitive file names (such as Windows or Mac OS X). If you are variable to 0 with --lower-case-table-names=0  on A Case-insensitive file system and Access myisam  tablenames using different lettercases, index corruption may result.
1 Table names is stored in lowercase on disk and name comparisons is not case sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases.
2 Table and database names is stored on disk using the "Lettercase specified CREATE TABLE CREATE DATABASE in the" or statement, but MySQL Conv ERTs them to lowercase on lookup. Name comparisons is not case sensitive. This works with file systems that is not a case sensitive! InnoDB table names is stored in lowercase, as fo R lower_case_table_names=1 .

If you want to set the table name to be case insensitive in a Linux environment, you can use the following command:

Mysqld--set-lower_case_table_names=1;

Or add a configuration entry in the MySQL server configuration file:

Vi/etc/my.cnf

[Plain]View PlainCopy
      1. # The MySQL server
      2. [Mysqld]
      3. Set-variable=lower_case_table_names=1

How does MySQL database set table name case insensitivity?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.