MySQL Lowercase Table Names in Windows Uppercase names on Unix

前端 未结 3 654
[愿得一人]
[愿得一人] 2020-12-14 01:55

I have a a problem whereby my production server runs Unix and my dev server runs MS Windows. The problem is that Windows is not case sensitive and Unix is. So my table set

相关标签:
3条回答
  • 2020-12-14 02:20

    Taken from dev.mysql.com:

    To avoid data transfer problems arising from lettercase of database or table names, you have two options:

    • Use lower_case_table_names=1 on all systems. The main disadvantage with this is that when you use SHOW TABLES or SHOW DATABASES, you do not see the names in their original lettercase.
    • Use lower_case_table_names=0 on Unix and lower_case_table_names=2 on Windows. This preserves the lettercase of database and table names. The disadvantage of this is that you must ensure that your statements always refer to your database and table names with the correct lettercase on Windows. If you transfer your statements to Unix, where lettercase is significant, they do not work if the lettercase is incorrect.

    Exception: If you are using InnoDB tables and you are trying to avoid these data transfer problems, you should set lower_case_table_names to 1 on all platforms to force names to be converted to lowercase.

    If you plan to set the lower_case_table_names system variable to 1 on Unix, you must first convert your old database and table names to lowercase before stopping mysqld and restarting it with the new variable setting.

    0 讨论(0)
  • 2020-12-14 02:21

    There is one easy solution:

    Always name your tablenames lowercase.

    0 讨论(0)
  • 2020-12-14 02:31

    The universal guiding philosophy of Windows with respect to case is "case-insensitive, case stored". That means Windows never intends to discard your case, so it's a little mysterious why your tables on Windows are lower-case.

    Apologies if this is a dumb question, but have you tried renaming the tables on the Windows machine so they have the correct case pattern?

    0 讨论(0)
提交回复
热议问题