InnoDB the “case-sensitive monster”
Posted in Programming, Server Administration, webdesign on June 4th, 2010 by OleHello,
this posting is about InnoDB’s limitation of lower / upper cases and the resulting problems of
InnoDB database migrations to different operating systems.
THE TASK:
Import an InnoDB database from Mac OS MySQL 5.x to Linux MySQL 5.x (in our case Rhel 5 ).
No big deal, I thought.
Made a mysql dump and imported the dump to Linux. 5 minutes work, just the way admins love it !
THE CHALLENGE:
Imported the dump. I am done! That’s what I thought. Just let’s check the app that accesses the freshly imported DB.
Running the app brought me exceptions. Some tables couldn’t be found… URGH! Checked the tables… everything was fine. The dump was fine… the tables were present. WTF!!!!!
THE SOLUTION:
After 10 hours of pain, we found the solution.
MySQL and especially the storage engine InnoDB depends on the case sensitivity of the operating system. Windows and Mac OS (by default) are not case-sensitive. So if you are importing a Mac or Win DB-dump to a case-sensitive operating system (like Linux), the DB will be handled case sensitively, although the dump is not a case-sensitive one. I think this problem should be fixed. I know fixing this problem is nearly impossible because the OS has to be capable of doing this. But giving some sort of warning while importing a non-case-sensitive DB to a case-sensitive DB-Server… that can’t be so difficult !
How to fix our specific problem:
Add the following line to your MySQL Server Config:
lower_case_table_names=1
By default Windows MySQL uses lower_case_table_names=0 and MacOS MySQL lower_case_table_names=2
The MySQL documentation advises setting lower_case_table_names=1 for InnoDB. For more information, please read the MySQL documentation.
Popularity: 18% [?]
