In cross-platform programming, we should note that the default values of some MySQL System variables are different on Windows and Linux, such as the case variables of MySQL table names.
In Windows, the default value of the lower_case_table_names variable is 1, the value is 0 in Linux, and the value is 2 in Mac OS;
The variable value is defined as follows:
| Value |
Meaning |
0 |
Table and database names are stored on disk using the lettercase specified inCREATE TABLEOrCREATE DATABASEStatement. Name comparisons are case sensitive. You shocouldNotSet 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 force this variable to 0--lower-case-table-names=0On a case-insensitive file system and accessMyISAMTablenames using different lettercases, index partition uption may result. |
1 |
Table names are stored in lowercase on disk and name comparisons are 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 are stored on disk using the lettercase specified inCREATE TABLEOrCREATE DATABASEStatement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. This worksOnlyOn file systems that are not case sensitive!InnoDBTable names are stored in lowercase, aslower_case_table_names=1. |
To set the table name to case insensitive in Linux, run the following command:
Mysqld -- SET-lower_case_table_names = 1;
You can also add configuration items to the MySQL server configuration file:
VI/etc/My. CNF
# The MySQL server[mysqld]set-variable=lower_case_table_names=1
Iefreer