Table names in MySQL

13 Apr 2007

To quote from the manual

In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory (and possibly more, depending on the storage engine). Consequently, the case sensitivity of the underlying operating system determines the case sensitivity of database and table names. This means database and table names are case sensitive in most varieties of Unix

I always get bitten by this and am now making a blog entry in the hope that I’ll remember.

I have one client where their ecommerce system was setup using SquirrelCart. I came along later and built an admin module so they could manage the rest of the site. The squirrelcart has tablenames in mixed-case, but I always use lower-case for all table and field names.

Occasionally I’ll write some code to query squirrelcart tables. (E.g. squirrelcart lets people use discount codes but it doesn’t report on how often the discount codes are used, so that’s an add-on) My code always works when I test it on the development machine, but flips when I upload it. And it’s because I type the squirrelcart table names in lowercase.