PHP/MYSQL: Why is my database all of the sudden case-sensitive for table names on my Linux server (and not on my XP server)?
how can i make it so that t开发者_JS百科he tables are case insensitive?
Table names are case-sensitive based on the OS's filesystem. On windows, filenames are not case-sensitive, so you can specify either. However, on Linux, filenames are case-sensitive. Hence the difference.
Best practice is to make your SQL conform exactly to the table name.
MySQL Documentation on identifier case sensitivity
Tables in MySQL are files (named the same as the table) behind the scenes. If those files are stored on a case-sensitive filesystem (like, say, just about every FS Linux supports), then MySQL will care about the case of table names. On the other hand, Windows filesystems tend to ignore case when looking up files, so any case could work.
You may be able to use a different engine for the database (InnoDB may be case insensitive, as it stores its tables differently), but really, you ought to be using consistent case all the time -- that'd make case sensitivity irrelevant.
MySQL metadata is case sensitive by default on Linux.
To avoid that go to /etc/my.cnf and put the following line:
lower_case_table_names = 1
精彩评论