MySQL error 1146 "Table doesn't exist" when the table obviously exists: the lower_case_table_names trap
Problem
After moving a schema from a macOS dev machine to the Linux staging server:
ERROR 1146 (42S02): Table 'shop.Users' doesn't existSHOW TABLES; on the same server lists Users. SELECTing from users (lowercase) works. The exact case that works locally fails on Linux. The ORM's generated queries used Users because the migration created it that way.
Root cause
Table name case sensitivity on Linux depends on lower_case_table_names:
0(Linux default): stored and compared exactly —Usersandusersare different tables.1(macOS/Windows default): stored lowercase, comparisons case-insensitive.
So the dev machine happily resolved Users against a table stored as users, and staging — where the migration actually created Users — breaks the moment anything queries lowercase. The inverse also bites: a dump created with mixed case on macOS deploys fine, then breaks under lower_case_table_names=0 only for queries that rely on folding.
The setting is also immutable after initialization on MySQL 8: you cannot flip it in my.cnf on an existing datadir; the server refuses to start. Plan accordingly.
SHOW VARIABLES LIKE 'lower_case_table_names';
… 1 more line in the fix🔒 the fix — including 6 code blocks — is members-only. $1/mo unlocks everything.