Is MYSQL CASE INSENSITIVE ?????
Hello Friends,
Today I want to ask a question to all of you, "Is mysql case insensitive ?".
and, Most of the answer is "YES". Mysql is a case insensitive.
Ok, One More Question :
If I created a database or Table with name "TESTDATA", now when i use
>show databases;
it will show : testdata
why i cant see database name in the original letter case, which i have given.
Well friends, thats not enough to know. Mysql gives you functionality to change its case sensitivity.
I will tell you some interesting facts about mysql :
1) Case sensitivity of mysql is dependent of Operating System. Key factor is how the database and tables are stored on the disk.
" MySql is case sensitive for variety of unix system. But case Insensitive for Windows."
One notable exception
is Mac OS X, which is Unix-based but uses a default file system
type (HFS+) that is not case sensitive. However, Mac OS X also
supports UFS volumes, which are case sensitive just as on any
Unix.
But Trigger names are always case
sensitive, which differs from standard SQL.
Now I will tell you how you can change case sensitivity ?
How table and database names are stored on disk and used in
MySQL is affected by the
system
variable, which you can set when starting "mysqld". System Variable lower_case_table_names
can take
the values shown in the following table. On Unix, the default
value of
is 0. On Windows the default value is 1. On Mac 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 Mac
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 . |
If you want to change the case sensitivity for my sql , you only need to change the value of this system variable "lower_case_table_names". you can change this system variables in the configuration file also (.cnf) file.
No comments:
Post a Comment