Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I force MySql table name case sensitivity on file systems that aren't case sensitive

So our target environment is linux, making mysql case-sensitive by default. I am aware that we can make our linux environment not case sensitive with the lower_case_table_names variable, but we would rather not. We have a few times been bitten with a case mismatch because our dev rigs are OSX, and mysql is not case sensitive there.

Is there a way we can force table names to be case sensitive on my OSX install of MySql (5.0.83 if that matters) so that we catch a table name case mismatch prior to deploying to the integration servers running on linux?

like image 631
Brian Deacon Avatar asked Apr 28 '10 15:04

Brian Deacon


1 Answers

Set lower_case_table_names=0 in my.cnf.

If you installed via homebrew, the file is here: /usr/local/Cellar/mysql/<version>/my.cnf

Queries with tables should now be case sensitive: mysql> select count(*) from user; ERROR 1146 (42S02): Table 'xxx.user' doesn't exist mysql> select count(*) from User; +----------+ | count(*) | +----------+ | 1 | +----------+ 1 row in set (0.00 sec)

like image 176
shad Avatar answered Nov 01 '22 11:11

shad