Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2009
    Posts
    24

    Question Unanswered: 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?

  2. #2
    Join Date
    Nov 2009
    Posts
    24
    anyone?

    been dweling on this problem for two weeks now

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    on windows MySQL is case insensitive
    on *NIX MySQL is case sensitive
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    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)

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    obviously the "set-it-and-forget-it" strategy (apologies to ron popeil) is simply to put all your identifiers into lower case
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    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.

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Nothing but lower case and use underscores where appropriate

    see_what_i_mean
    George
    Home | Blog

  8. #8
    Join Date
    Nov 2009
    Posts
    24
    cheers

    I will follow that convention.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •