4

I've been trying to setup lower_case_table_names for ages in MySQL 8.0 without success. What is the procedure to set this up in 8.0?

In previous versions of mysql I was able to override the variable in /etc/mysql/mysql.cnf by adding the following lines:

[mysql] 
lower_case_table_names = 1

But when I try to restart the server / service mysql does not restart.
In the past all mysql servers had this setting working fine I just don`t know how to do the same in 8.0.

0

2 Answers 2

11

The server variable lower_case_table_names is described in the relevant documentation page:

Identifier Case Sensitivity, where it also mentions:

lower_case_table_names can only be configured when initializing the server. Changing the lower_case_table_names setting after the server is initialized is prohibited.

Some more details appear in the linked page about server variables:

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 based on 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.

1
  • lower_case_table_names is set to 1 on windows systems and lower_case_table_names is set to 0 on linux systems or the other way around, i just know they set it diff by default, i hope this helps. Mar 9, 2022 at 9:53
0

You need to reinit MySQL data directory. According to https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html lower_case_table_names can only be configured when initializing the server.

If you are running Ubuntu than you can do it using this script https://github.com/igrmk/ubuntu-reinit-mysql.

Please note that your data will be DESTROYED! So create a backup before running it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.