MySQL Table不存在错误,但确实存在 [英] MySQL Table does not exist error, but it does exist
问题描述
有人知道您的表确实存在时,在什么条件下会收到1146: Table '<database>.<table>' doesn't exist
错误?
Does anyone know under what conditions you can receive an 1146: Table '<database>.<table>' doesn't exist
error when your table does, in fact, exist?
我在5台服务器上使用了相同的代码,但我最近租用的服务器上只有一个显示此错误,因此我怀疑这可能是某种设置或安装错误.我可以从命令行执行我的sql语句.很明显,我也可以从命令行查看该表.建立连接时,我没有任何连接错误(我使用的是mysqli,btw).
I use the same code on 5 servers, only one that I recently rented is showing this error, so I suspect it may be a settings or install error of some kind. I can execute my sql statement from the command line just fine. I can, obviously, see the table from the command line as well. I don't get any connection errors when I establish a connection (I'm using mysqli, btw).
任何帮助将不胜感激.
确切查询:
$sql = "SELECT DISTINCT(mm_dic_word) AS word FROM spider.mm_dictionary WHERE mm_dic_deleted=0";
推荐答案
基本上,我认为我遇到的问题是由于密码哈希长度不同.就我而言,我有一台新服务器,在其上完成了一个完整的mysql转储,还传输了密码和用户信息.新服务器已经使用具有16个字符长度的哈希值的root用户进行了初始化,但是我的旧服务器正在使用较新的32个字符哈希值的长度.
Basically, I believe the problem that I was experiencing was due to differing password hash lengths. In my case, I got a new server, did a complete mysql dump on it which transferred passwords and user info also. The new server was already initialized with a root user that had a 16char length hash, but my old server was using the newer 32 char hash lengths.
我必须进入my.conf,将旧密码设置为0(否则,每次尝试更新数据库时,新更新的长度为16个字符).然后,通过命令UPDATE mysql.user SET password=PASSWORD('password here');
将所有密码更新为相同的密码,然后刷新特权.
I had to go into my.conf set the old passwords setting to 0 (other wise every time I tried updating the database, the new update was 16 chars in length). I then updated all the passwords to be the same via the command UPDATE mysql.user SET password=PASSWORD('password here');
, then I flushed privileges.
显然,让每个用户都使用相同的密码是一个非常糟糕的主意,因此,在确认它可以正常工作之后,我逐个更改了密码.
Obviously, having every user with the same password is a really bad idea, so I changed them one by one after I confirmed that it was working.
我输入了一个博客条目,其中涉及到我所做的其他一些不起作用的事情此处,在我尝试此解决方案之前(以防万一这些更改影响了我的结果),我认为上述解决方案是完整的...但是我没有尝试重现该错误,因此我不确定100%.
I typed up a blog entry that goes into some of the other things I did that didn't work here, before I happened upon this solution (just in case one or more of those changes effected my outcome) however, I think that the above solution to be complete... but I haven't tried to reproduce the error so I can't be 100% sure.
这篇关于MySQL Table不存在错误,但确实存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!