这套MySQL的版本是 8.0.40。
MySQL 8.0 开始,是不让初始化之后修改 lower_case_table_names 的。
官方文档也有详细介绍:
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names
取出关键的两段翻译一下:
It is prohibited to start the server with a lower_case_table_names setting that is different from the setting used when the server was initialized. The restriction is necessary because collations used by various data dictionary table fields are determined by the setting defined when the server is initialized, and restarting the server with a different setting would introduce inconsistencies with respect to how identifiers are ordered and compared.
禁止使用与服务器初始化时使用的设置不同的lower_case_table_names设置启动服务器。这个限制是必要的,
因为各种数据字典表字段使用的排序规则是由服务器初始化时定义的设置决定的,使用不同的设置重新启动服务器会导致标识符排序和比较方式的不一致。
It is therefore necessary to configure lower_case_table_names to the desired setting before initializing the server. In most cases, this requires configuring lower_case_table_names in a MySQL option file before starting the MySQL server for the first time.
因此,有必要在初始化服务器之前将lower_case_table_names配置为所需的设置。在大多数情况下,这需要在第一次启动MySQL服务器之前在MySQL选项文件中配置lower_case_table_names。
一句话总结:8.0你敢改,MySQL就敢崩给你看。
不过,MySQL 5.7是没有这个限制的,具体可以参考5.7对于这个参数的解释:
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_lower_case_table_names