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
- # The MySQL server
- [Mysqld]
- Set-variable=lower_case_table_names=1
How does MySQL database set table name case insensitivity?