Search code examples
mysqlsqlmysql-error-1146

MySQL says table is there, then says it's not


check the database-generating sql (looks fine):

CREATE TABLE `HourOfDay` (
  `id` int(11) NOT NULL,
  `hourString` varchar(2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

check the file system (it's there):

# ls -al Mycomp_test | grep -i hour
-rw-rw----    1 _mysql  wheel      0 Mar  1 08:13 HourOfDay.MYD
-rw-rw----    1 _mysql  wheel   1024 Mar  1 08:13 HourOfDay.MYI
-rw-rw----    1 _mysql  wheel   8598 Mar  1 08:13 HourOfDay.frm

check the database (looks good):

»mysql -u root Mycomp_test -e 'show tables' | grep -i hour
HourOfDay

check the database table (oops wtf!?):

»mysql -u root Mycomp_test -e 'show create table HourOfDay'
ERROR 1146 (42S02) at line 1: Table 'mycomp_test.hourofday' doesn't exist

UPDATE: More info

  • This is an OSX system running mysql-5.1.38-osx10.5-x86_64

  • If I drop the database and recreate it I get the same error (it's reliably reproducible).


Solution

  • 8.2.2. Identifier Case Sensitivity

    »cat /etc/my.cnf 
    [mysqld]
    lower_case_table_names=2