Friday, December 3, 2010

Non case and case sensitive MySQL tabels

MySQL table names are sometimes case sensitive depending on what configuration you have and if you are running in a Unix or Windows environment.
What controls if it's non case or case sensitive is a setting in my.cnf (my.ini in Windows)

What you'll be looking for if lower_case_table_names is set in your my.cnf
However if you haven't specified the default value of lower_case_table_names , then they are:
  • Unix environment the default value is 0
  • Windows the default value is 1
  • Mac OS X, the default value is 2
You can also make a SQL query to check the current settings, by doing this query:
show variables like "%lower%"

If you don't want to have a non case sensitive setting then lower_case_table_names should be set to:
lower_case_table_names = 1
If you want it to be case sensitive then the settings should be 2.
Save your changes in my.cnf then restart your mysql server so the new configuration will be applied.

No comments:

Post a Comment