MySQL Case sensitive issues

Source: Internet
Author: User

One, 1 CREATE TABLE name (name VARCHAR (10));

For this table, by default, the results of the following two queries are the same:

The

code is as follows:


SELECT * from TABLE NAME WHERE name= ' clip ';


SELECT * from TABLE NAME WHERE name= ' Clip ';

MySQL default query is case-insensitive, if you need to distinguish between him, must be in the table, binary marked sensitive properties.

The

code is as follows:


CREATE TABLE NAME (


name VARCHAR (Ten) BINARY


        );

2 Implement SELECT * from TABLE NAME where BINARY name= ' Clip ' in SQL statement;

3 Setting the character set:

UTF8_GENERAL_CI--Case insensitive

utf8_bin--Case Sensitive

Second, MySQL is not case-sensitive under Windows, the script file into MySQL after the table name will automatically be converted to lowercase, and then want to put the database export to the Linux server to use when the error. Because in Linux the table name is case-sensitive and cannot find a table, many of them are said to change the MySQL settings under Linux so that it is not case-sensitive, but there is no way to turn to the case of Windows sensitivity. In fact, the method is the same, the corresponding change in Windows MySQL settings on the line.

Specific actions:

Add a row to the MySQL profile My.ini:

Lower_case_table_names = 0

0: Case-sensitive, 1: case-insensitive

MySQL under Linux database name, table name, column name, alias capitalization rule is this:

1, the database name and table name is strictly case-sensitive case;

2, the alias of the table is strictly case-sensitive;

3, column name and column alias in all cases are ignored case;

4, the variable name is also strictly case-sensitive; MySQL is case-insensitive under windows

The above is the entire content of this article, I hope you can enjoy.

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.