If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MySQL case sensitive?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-24-09, 14:57
Theresonly1 Theresonly1 is offline
Registered User
 
Join Date: Nov 2009
Posts: 24
Question MySQL case sensitive?

Hello.

Working on a database (MySQL) and realised some strange things.

I have MySQL database setup on both my PC and Laptop. Once i created my tables in PC database the table names all starts with lowercase (but i specified it to be an Uppercase when i created it). However, on my laptop database it preserves the casing.

e.g. PC database

create table Orders (....)

but when i view it on MysQl command line its: orders

e.g. Laptop database (this seems fine)

create table Orders (....)

and on Mysql command line its: Orders


----


So what is wrong? is it suppose to be like that? Or am i missing some settings on my PC MySQL database?
Reply With Quote
  #2 (permalink)  
Old 11-30-09, 15:13
Theresonly1 Theresonly1 is offline
Registered User
 
Join Date: Nov 2009
Posts: 24
anyone?

been dweling on this problem for two weeks now
Reply With Quote
  #3 (permalink)  
Old 11-30-09, 16:28
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
on windows MySQL is case insensitive
on *NIX MySQL is case sensitive
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #4 (permalink)  
Old 11-30-09, 18:04
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
Quote:
Originally Posted by healdem View Post
on windows MySQL is case insensitive
on *NIX MySQL is case sensitive
This is - by default - only true for MyISAM tables (because a table maps to a filename and the filesystem is case sensitive)
For InnoDB tables this depends on the setting innodb_file_per_table. If this is true one table again maps to a filesystem file and thus is case-sensitive again.

Finally all this depends on the parameter lower_case_table_names.
If that is set to 1 or 2 table names are never case-sensitive (regardless of the underlying OS oder the storage engine)
Reply With Quote
  #5 (permalink)  
Old 11-30-09, 23:09
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
obviously the "set-it-and-forget-it" strategy (apologies to ron popeil) is simply to put all your identifiers into lower case
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 12-01-09, 15:02
Theresonly1 Theresonly1 is offline
Registered User
 
Join Date: Nov 2009
Posts: 24
hm..

My tables are all InnoDB. Probably should put all my identifiers to lower case..

But i want to follow a database naming convention (if there is one) for good design purposes.
Reply With Quote
  #7 (permalink)  
Old 12-01-09, 16:25
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Nothing but lower case and use underscores where appropriate

see_what_i_mean
__________________
George
Twitter | Blog
Reply With Quote
  #8 (permalink)  
Old 12-06-09, 15:34
Theresonly1 Theresonly1 is offline
Registered User
 
Join Date: Nov 2009
Posts: 24
cheers

I will follow that convention.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On