Wednesday, July 4, 2012

MySQL Table Name Case Sensitivity


When running MySQL in Linux, the default behavior is for table names to be case-sensitive during table name lookups. This can sometimes cause problems, especially if the developer of an application developed on Mac OS or Windows, where the default behavior can be different.

In order to control MySQL case-sensitive behavior, use the "lower_case_table_names" parameter in the my.cnf file. There are 3 possible values:

0: Case sensitive. Table names are stored on disk using the lettercase specified during creation. Name comparisons are case sensitive. Requires case-sensitive filesystem.

1: Case insensitive. Table names are stored in lowercase on disk. MySQL converts all table names to lowercase on storage and lookup.

2: Case insensitive. Table names are stored on disk using the lettercase specified during creation, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. Use only on case insensitive filesystems.

For Linux, choose "lower_case_table_names =1" if you want case insensitive behavior.

Reference: http://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html

No comments:

Post a Comment