MySQL is case insensitive (Linux and Windows)

Source: Internet
Author: User

 MySQL in Linux Database Name, table name, column name, alias case-sensitive rules:
1. The database name and table name are case sensitive.

2. The table alias is case sensitive.

3. The column name and column alias are case-insensitive in all cases.

4. Variable names are case sensitive.

Note:

A. After MySQL is installed in Linux, the default value is case-sensitive for table names, but not for column names.

B. How to change the case sensitivity rules of table names: Log On with the root account and log on to/etc/My. CNF or/etc/MySQL/My. add lower_case_table_names = 1 after [mysqld] In CNF and restart the MySQL service. If the setting is successful, the table name is case-insensitive.

NOTE: If my. CNF cannot be found in/etc or/etc/MySQL, You need to copy it from other places, because when installing MySQL using rpm, You need to manually copy my. CNF. Specific operations:

Find the *. CNF file under/usr/share/MySQL/, copy one of the files to/etc/and change it to my. CNF. The command is as follows:

[Root @ test1 MySQL] # cp/usr/share/MySQL/my-medium.cnf/etc/My. CNF

Where:

My-small.cnf is designed for small databases. This model should not be used in databases that contain common projects.
My-medium.cnf is designed for medium-sized databases.

The my-large.cnf is designed for a computer dedicated to a SQL database.

My-huge.cnf is designed for databases in enterprises.

[Windows]

MySQL databases, table names, column names, and aliases in windows are case-insensitive..

If you want to use case-sensitive data, use the mysqld section in my. ini.

Add lower_case_table_names = 0

  Note: even if this setting is changed in windows, the query is case insensitive. Only the case sensitivity is different during import and export.

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.