問題描述
MySQL 中的表名是否區分大小寫?
Are table names in MySQL case sensitive?
在我的 Windows 開發機器上,我擁有的代碼能夠查詢我的表,這些表似乎都是小寫的.當我部署到我們數據中心的測試服務器時,表名似乎以大寫字母開頭.
On my Windows development machine the code I have is able to query my tables which appear to be all lowercase. When I deploy to the test server in our datacenter the table names appear to start with an uppercase letter.
我們使用的服務器都在 Ubuntu 上.
The servers we use are all on Ubuntu.
推薦答案
一般:
數據庫和表名在 Windows 中不區分大小寫,而在大多數 Unix 版本中區分大小寫.
在MySQL中,數據庫對應數據中的目錄目錄.數據庫中的每個表至少對應一個數據庫目錄中的文件.因此,區分大小寫的底層操作系統在區分大小寫中起作用數據庫和表名.
In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory. Consequently, the case sensitivity of the underlying operating system plays a part in the case sensitivity of database and table names.
可以使用系統變量lower_case_table_names
(在[mysqld]下的my.cnf配置文件中)配置表名如何存儲在磁盤上.
One can configure how tables names are stored on the disk using the system variable lower_case_table_names
(in the my.cnf configuration file under [mysqld]).
閱讀部分:10.2.2 標識符區分大小寫 了解更多信息.
Read the section: 10.2.2 Identifier Case Sensitivity for more information.
這篇關于MySQL 中的表名是否區分大小寫?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!