Are column and table name case sensitive in MySQL?

If I have a column names called category_id and Category_Id, are they different?

And if I have table called category and Category, are they different?


Solution 1:

On Unix, table names are case sensitive. On Windows, they are not. Fun, isn't it? Kinda like their respective file systems. Do you think it's a coincidence?

In other words, if you are developing on Windows but planning on deploying to a Linux machine, better test your SQL against a Linux-based MySQL too, or be prepared for mysterious "table not found" errors at prod time. VMs are cheap these days.

Field (column) names are case-insensitive regardless.

EDIT: we're talking about the operating system on the MySQL server machine, not client.

Solution 2:

From the MySQL documentation:

database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix. One notable exception is Mac OS X, which is Unix-based but uses a default file system type (HFS+) that is not case sensitive.

and

Column and index names are not case sensitive on any platform, nor are column aliases.

Solution 3:

For database and table names, it depends on the underlying operating system. See 8.2.2. Identifier Case Sensitivity