ITPub博客

首页 > 数据库 > MySQL > MySQL表名大小写敏感变量配置

MySQL表名大小写敏感变量配置

原创 MySQL 作者:amazinget 时间:2014-10-28 23:15:34 0 删除 编辑

在windows上lower_case_table_names变量的缺省值为1; 在linux上为0; 在mac os上为2;

详细定义如下:

0敏感 1不敏感 2macos?
0 Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE 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.
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 in the CREATE TABLE or CREATE 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 forlower_case_table_names=1.


在linux环境中想设置表名为大小写不敏感:
mysqld --SET-lower_case_table_names=1;

或者在mysql server的配置文件中添加配置项:
# The MySQL server 
[mysqld] 
set-variable=lower_case_table_names=1



参考链接

http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html#sysvar_lower_case_table_names


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29959940/viewspace-1312462/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: java split 竖线
请登录后发表评论 登录
全部评论

注册时间:2014-10-15

  • 博文量
    14
  • 访问量
    70135