MySQL table name/column name case sensitivity _ MySQL

Source: Internet
Author: User
MySQL table name case sensitivity problem bitsCN.com
MySQL table names/column names are case sensitive. in MySQL, databases and table pairs are stored in directories and files under those directories. Therefore, the sensitivity of the operating system determines the case sensitivity of the database and table names. This means that the database and table names are case-insensitive in Windows and are case-sensitive in most types of Unix systems. A special case is Mac OS X, which is used by the default HFS + file system. However, Mac OS x also supports UFS volumes, which are case sensitive in Mac OS X, just as they are on any Unix. Note: Although the database and table names in Windows are case-insensitive, you should not reference a given database or table in the same query. The following query will not work because it references a table with my_table and MY_TABLE: mysql> SELECT * FROM my_table WHERE MY_TABLE.col = 1; column names and column aliases are case-insensitive in all cases. Table aliases are case sensitive. The following query will not work because it uses a and A to reference aliases: mysql> SELECT col_name FROM tbl_name AS a WHERE. col_name = 1 or. col_name = 2; if it is difficult to use uppercase or lowercase letters in the memory database and table name, we recommend that you use the same conventions, such as creating databases and tables with lowercase letters. Another way to avoid this problem is to start mysqld with The-O lower_case_table_names = 1 parameter. By default, this option is 1 in Windows and 0 in Unix. If lower_case_table_names is 1, MySQL converts all table names to small lines during storage and search. (This option also applies to database names starting from MySQL 4.0.2 .) Note: When you change this option, you must first convert the old table name to lowercase letters before starting mysqld. $ Pwd/data1/etl/aiinsight/ScheduleServer/mysql/support-files $. /mysql. server stop $ pwd/data1/etl/aiinsight/ScheduleServer/mysql/bin. /mysqld_safe -- lower_case_table_names Method 2: modify my. add lower_case_table_names = 1bitsCN.com to the cnf configuration file in [mysqld ].
Related Article

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.