In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory (and possibly more, depending on the storage engine). Consequently, the case sensitivity of the underlying operating system plays a part in the case sensitivity of database, table, and trigger names. Such names are not case sensitive in Windows, but are case sensitive in most varieties of Unix.
The lower_case_table_names system variable also affects how the server handles identifier case sensitivity, as described later in this section.
To check what is the value of this variable in you installed MySql, run below command
mysqladmin -u <user name> -p variables
Check the lower_case_table_names in the list. Find more details about this variable here.
If lower_case_table_names is 0, it means your table, functions, triggers names are case sensitive.
lower_case_table_names
can take the values shown in the following table. This variable does not affect case sensitivity of trigger identifiers. On Unix, the default value of lower_case_table_names
is 0. On Windows, the default value is 1. On OS X, the default value is 2.Value | Meaning |
---|---|
0 | Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement. Name comparisons are case sensitive. You should not set this variable to 0 if you are running MySQL on a system that has case-insensitive file names (such as Windows or OS X). If you force this variable to 0 with --lower-case-table-names=0 on a case-insensitive file system and access MyISAM tablenames using different lettercases, index corruption may result. |
1 | Table names are stored in lowercase on disk and name comparisons are not case sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases. |
2 | Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons are not case sensitive. This works only on file systems that are not case sensitive! InnoDB table names are stored in lowercase, as for lower_case_table_names=1 . |
To change the value of ‘lower_case_table_names’, follow below steps.
- Go to my.conf file
- look up for: # The MySQL server [mysqld]
- add this right below it: lower_case_table_names = 2
- save the file and restart MySQL service
Now, fire below command.
mysqladmin -u <user name> -p variables
Comments
Post a Comment