MySQL 说表存在,然后说表不存在
检查数据库生成 sql(看起来不错):
CREATE TABLE `HourOfDay` (
`id` int(11) NOT NULL,
`hourString` varchar(2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
检查文件系统(它在那里):
# 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
检查数据库(看起来不错):
»mysql -u root Mycomp_test -e 'show tables' | grep -i hour
HourOfDay
检查数据库表(哎呀天哪!?):
»mysql -u root Mycomp_test -e 'show create table HourOfDay'
ERROR 1146 (42S02) at line 1: Table 'mycomp_test.hourofday' doesn't exist
更新:更多信息
这是一个运行 mysql-5.1.38-osx10.5-x86_64 的 OSX 系统
如果我删除数据库并重新创建它,我会得到相同的错误(它可以可靠地重现)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“
表'mycomp_test.hourofday'不存在
”是可疑的,因为在unix/linux系统上它应该是HourOFDay
。"
Table 'mycomp_test.hourofday' doesn't exist
" is suspicious, as it should beHourOFDay
on a unix/linux system.8.2.2. 标识符区分大小写
8.2.2. Identifier Case Sensitivity