在MySQL中,數據庫對應數據目錄中的目錄。數據庫中的每個表至少對應數據庫目錄中的一個文件(也可能是多個,取決于存儲引擎)。因此,所使用操作系統的大小寫敏感性決定了數據庫名和表名的大小寫敏感性。 在大多數Unix中數據庫名和表名對大小寫敏感,而在Windows中對大小寫不敏感。一個顯著的例外情況是Mac OS X,它基于Unix但使用默認文件系統類型(HFS+),對大小寫不敏感。然而,Mac OS X也支持UFS卷,該卷對大小寫敏感,就像Unix一樣。 變量lower_case_file_system說明是否數據目錄所在的文件系統對文件名的大小寫敏感。ON說明對文件名的大小寫不敏感,OFF表示敏感。 Mysql官方文檔的介紹:
Value
Meaning
Table and database names are stored on disk using the lettercase specified in the CREATE TABLE orCREATE DATABASE statement. Name comparisons are 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 force this 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.
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.
Table and database names are stored on disk using the lettercase specified in the CREATE TABLE orCREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. This works only on file systems that are not case sensitive! InnoDB table names are stored in lowercase, as for lower_case_table_names=1.
If you plan to set the lower_case_table_names system variable to 1 on Unix, you must first convert your old database and table names to lowercase before stopping mysqld and restarting it with the new variable setting. To do this for an individual table, use RENAME TABLE: