MySQL Table does not exist error, but it does exist

后端 未结 10 1097
臣服心动
臣服心动 2020-12-03 07:32

Does anyone know under what conditions you can receive an 1146: Table \'.

\' doesn\'t exist error when your table does, in fact, exi
相关标签:
10条回答
  • 2020-12-03 07:42

    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.

    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.

    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.

    0 讨论(0)
  • 2020-12-03 07:42

    It could be related to having InnoDB and MyISAM tables together. If you copy the database files, the MyISAM will be fine and the InnoDB will show up but fail to work.

    0 讨论(0)
  • 2020-12-03 07:45

    Using the mysqlcheck would be in order in this case - so you can discard table sanity problems & repair them if neeeded.

    0 讨论(0)
  • 2020-12-03 07:46

    This just happened to me and after a while I found the answer on a blog article, and wanted to put it here as well.

    If you copy the MySQL data directory from /var/lib/mysql to /path/to/new/dir, but only copy the database folders (i.e. mysql, wpdb, ecommerce, etc) AND you do have innodb tables, your innodb tables will show up in 'show tables' but queries on them (select and describe) will fail, with the error Mysql error: table db.tableName doesn't exist. You'll see the .frm file in the db directory, and wonder why.

    For innodb tables, it's important to copy over the ib* files, which in my case were ibdata1, ib_logfile0, and ib_logfile1. Once I did the transfer making sure to copy those over, everything worked as expected.

    If your my.cnf file contains "innodb_file_per_table" the .ibd file will be present in the db directory but you still need the ib* files.

    0 讨论(0)
  • 2020-12-03 07:46

    This happened to me when I was trying to select a table using UPPERCASE and the table name was lowercase.

    So, to solve this question, I put "lower_case_table_names=1" on my.cnf file.

    0 讨论(0)
  • 2020-12-03 07:51

    I have seen this on a centos 6.4 system with mysql 5.1 and an xfs filesystem.

    The tables show with 'show tables' but a select or describe fails with the table not existing message as you described. The files are where I expect them to be.

    The system was running fine for months, then after a service mysqld restart after changing /etc/my.cnf to set table_cache to 512 instead of 256, it went sideways.

    According to arcconf the raid controller thinks everything is fine. xfs_check does not find anything. the system-event-list of IPMI is clear. dmesg shows some complaints by iptables about connection tracking and dropping packages, so we may have been DOS'd, but since there is nothing really running outside facing on the server I don't see how it could affect mysql data integrity?

    I ended up promoting the slave to master and reloading the system, and now am wondering what could have caused the error, and if the choice of xfs on centos 6.4 is still a stable choice, or if the culprit was mysql 5.1.

    Oh yeah and never change a running system :)

    0 讨论(0)
提交回复
热议问题