国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

mysql 大小寫敏感 lower_case_table_names

2024-07-24 12:35:33
字體:
來源:轉載
供稿:網友
   在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.
 
  默認為0,大小寫敏感。
 
  設置1,大小寫不敏感。創建的表,數據庫都是以小寫形式存放在磁盤上,對于sql語句都是轉換為小寫對表和DB進行查找。
 
  設置2,創建的表和DB依據語句上格式存放,凡是查找都是轉換為小寫進行。
 
  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:
 
  當想設置lower_case_table_names = 1時,在重啟數據庫實例之前就需要將原來的數據庫和表轉換為小寫。
 
  官方文檔的解釋。要開啟lower_case_table_names = 1 。先要將大寫字母數據庫更改為小寫。否則將找不到數據庫名。
 
   所以要想忽略大小寫,還需要提前將大寫數據庫名更改小寫,否則報錯。數據庫名無法rename.可以新建一個小寫的數據庫名。
  然后rename table 到新的數據庫,完成表的遷移。
  在進行數據庫參數設置之前,需要掌握這個參數帶來的影響,切不可盲目設置。

(編輯:武林網)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 扎鲁特旗| 隆昌县| 正蓝旗| 昭觉县| 共和县| 双江| 巴中市| 濮阳市| 河北省| 海安县| 大安市| 康定县| 大新县| 吉安市| 山阳县| 赣榆县| 封丘县| 长治市| 雷波县| 库尔勒市| 桂东县| 宁强县| 石景山区| 阜南县| 墨江| 卢龙县| 广平县| 亚东县| 长武县| 万州区| 肥城市| 梧州市| 鹰潭市| 平顺县| 武鸣县| 彩票| 阜城县| 新绛县| 彩票| 库车县| 庆阳市|