Mysql 表名大小寫敏感

默認狀況下,mysql在建立數據庫對象時,是區分大小寫的。故與microsoft之間進行移植時,要特別注意是否存在問題。在mysql中大小寫與參數lower_case_table_names有很大關係。mysql

如下爲官方解釋:sql

If set to 0, table names are stored as specified and comparisons are case sensitive. If set to 1, table names are stored in lowercase on disk and comparisons are not case sensitive. If set to 2, table names are stored as given but compared in lowercase. This option also applies to database names and table aliases.數據庫

當設置爲0時,存儲和比較都是大小寫敏感的;當設置爲1是存儲時會轉換爲小寫,比較時不區分大小寫;當設置爲2時候,存儲時區分大小寫,比較的時與轉換爲小寫。此選項對數據庫名和數據表名起做用。app

lower_case_table_names是個只讀變量,不能直接設置生效,必須在配置文件中設置並重啓mysqld服務。spa

mysql> set lower_case_table_names=1;orm

相關文章
相關標籤/搜索