Garrett
Garrett

Reputation: 11725

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 the tables are case insensitive?

Upvotes: 0

Views: 1258

Answers (3)

user3704703
user3704703

Reputation: 1

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 

Upvotes: 0

Chris Henry
Chris Henry

Reputation: 12010

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

Upvotes: 7

cHao
cHao

Reputation: 86505

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.

Upvotes: 2

Related Questions