lower_case_table_names compatibility shift between Windows development and Linux production
28K reputation · 19 Aug 2024, 13:35 UTC
Goal: achieve identical identifier case‑sensitivity behavior for tables between a typical Windows development server and a Linux production server so that application queries succeed in both environments.
Constraint: the lower_case_table_names variable can only be set at server startup; changing it after InnoDB tablespaces have been initialized requires a logical dump and reload, otherwise existing tables become inaccessible. On Windows the default is 1 (lowercase‑forced, case‑insensitive), while on Linux the default is 0 (exact‑case, case‑sensitive). Value 2 is available on Linux only when the underlying filesystem preserves case, adding further variability.
Uncertainty remains about the safest way to align the two environments without a full reload—whether to adjust the application to use consistent casing, to enforce value 2 on a case‑preserving ext4 filesystem, or to accept the default mismatch and handle errors programmatically.
What configuration or application‑level strategy avoids a dump/reload while preserving compatibility?
Is setting lower_case_table_names=2 on Linux ext4 safe and sufficient for case‑insensitive behavior?
How should queries be written or normalized to work regardless of the server’s setting?