windows下的mysql为何加了lower_case_table_names=0设置后重启,还是表名无法区分大小写??

qiuzhizhe8888 2016-05-07 10:34:34
1、windows下的mysql为何在配置中加入了lower_case_table_names=0并且重启了mysql,仍旧不能设置表名大小写敏感?
2、windows下的mysql的schema的collation设置中,几乎看不到_cs支持大小写敏感的,尤其是UTF-8全是_ci。是windows下压根就不支持大小写敏感,只有linux下才行?
...全文
1535 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
williom25 2016-06-13
  • 打赏
  • 举报
回复
引用 2 楼 qiuzhizhe8888 的回复:
[quote=引用 1 楼 ACMAIN_CHM 的回复:] windows 操作系统本身在文件名上不支持大小写区别,所以这个参数仅对UNIX类的系统有用。
解决了,是mysql他读取my.ini有优先顺序。我之前修改的不是最优先的那个。这个是有效的,不改之前表名会被强制弄成小写。改了之后就可以大些了[/quote] 你好,想请问怎么解决的,我现在是mysql5.7,加了这个变量进去重启服务就会一直报错,想请问下是怎么解决的
gikod 2016-05-10
  • 打赏
  • 举报
回复
读读官方文档吧: Windows设置成0会导致MySQL的MyISAM损坏,还是别去冒这样的风险了。 说说你的需求,总会有解决办法的。 设置成2或许也是一个折中。

How table and database names are stored on disk and used in MySQL is affected by the lower_case_table_names system variable, which you can set when starting mysqld. lower_case_table_names can take the values shown in the following table. This variable does not affect case sensitivity of trigger identifiers. On Unix, the default value of lower_case_table_names is 0. On Windows, the default value is 1. On OS X, the default value is 2.

Value	Meaning
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 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 for lower_case_table_names=1.
If you are using MySQL on only one platform, you do not normally have to change the lower_case_table_names variable from its default value. However, you may encounter difficulties if you want to transfer tables between platforms that differ in file system case sensitivity. For example, on Unix, you can have two different tables named my_table and MY_TABLE, but on Windows these two names are considered identical. To avoid data transfer problems arising from lettercase of database or table names, you have two options:

Use lower_case_table_names=1 on all systems. The main disadvantage with this is that when you use SHOW TABLES or SHOW DATABASES, you do not see the names in their original lettercase.

Use lower_case_table_names=0 on Unix and lower_case_table_names=2 on Windows. This preserves the lettercase of database and table names. The disadvantage of this is that you must ensure that your statements always refer to your database and table names with the correct lettercase on Windows. If you transfer your statements to Unix, where lettercase is significant, they do not work if the lettercase is incorrect.

Exception: If you are using InnoDB tables and you are trying to avoid these data transfer problems, you should set lower_case_table_names to 1 on all platforms to force names to be converted to lowercase.
qiuzhizhe8888 2016-05-07
  • 打赏
  • 举报
回复
引用 1 楼 ACMAIN_CHM 的回复:
windows 操作系统本身在文件名上不支持大小写区别,所以这个参数仅对UNIX类的系统有用。
解决了,是mysql他读取my.ini有优先顺序。我之前修改的不是最优先的那个。这个是有效的,不改之前表名会被强制弄成小写。改了之后就可以大些了
ACMAIN_CHM 2016-05-07
  • 打赏
  • 举报
回复
windows 操作系统本身在文件名上不支持大小写区别,所以这个参数仅对UNIX类的系统有用。

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧