MySQL is case-insensitive to table names by default under Linux

Source: Internet
Author: User

There is a project deployed to the server, the log is always prompted to find the table.

Originally Linux under MySQL default to table name is case-sensitive.

Workaround:

One, the specification code, the table name all uppercase

Second, modify the MySQL configuration, so that the table name is automatically converted to lowercase.

1. Log in with root, modify/ETC/MY.CNF
2. Add a line under [mysqld]: Lower_case_table_names=1
3. Restart the database

Explain
0 Save the table name and database name on your hard disk using the uppercase and lowercase letters specified by the CREATE TABLE or CREATE DATABASE statement. The name comparison is case sensitive. On a case insensitive operating system such as Windows or Mac OS X we cannot set this parameter to 0 if--lowercase-table-names is coerced to 0 on case-insensitive file systems, and the MyISAM table name is accessed with a different case. May cause index corruption.
1 Table names are saved in lowercase on the hard disk, and the name comparisons are not case sensitive. MySQL converts all table names to lowercase on the storage and lookup tables. This behavior is also appropriate for database names and table aliases. The value is the default value for Windows.
2 The table name and database name are saved on the hard disk using the uppercase and lowercase letters specified by the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lower case on the lookup table. Name comparisons are not case sensitive, that is, they are saved by case, and are compared in lowercase. Note: Applies only on file systems that are not case sensitive! InnoDB table names are saved in lowercase.

MySQL is case-insensitive to table names by default under Linux

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.