I currently have run into a problem with case sensitivity in table names for a MySQL database. The site is being built locally on a Windows box, and I've noticed that any time I create a table, the table name winds up being forced to lowercase.

This isn't a problem under Windows, but after using mysqldump to create an sql script which I then upload to the main server and execute, the table names remain all lowercase. This obviously causes a problem on the server, because *nix is case sensitive, and henceforth my scripts no longer like to function properly.

I'm wondering if there is a way within MySQL to force case sensitive table names. Anyone know if this is possible?

    From MySQL manual (it seems that it has solution):

    In MySQL, databases and tables correspond to directories and files within those directories. 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-insensitive in Windows, and case-sensitive in most varieties of Unix. One prominent exception here is Mac OS X, when the default HFS+ file system is being used. However Mac OS X also supports UFS volumes, those are case sensitive on Mac OS X just like they are on any Unix. See section 1.8.3 MySQL Extensions to the SQL-92 Standard.

    ... ...

    One way to avoid this problem is to start mysqld with -O lower_case_table_names=1. By default this option is 1 on Windows and 0 on Unix.

      Thanks, I appreciate it. I started looking in the MySQL docs, but it appears I didn't look hard enough.

        Write a Reply...