[英]MySQL ERROR 1146 table doesn't exist after backup
In school after every lesson I need to backup my database so I copy database from mysql data directory and when I work again I paste it back in. 上完每堂课后,我需要在学校中备份数据库,以便从mysql数据目录复制数据库,然后在我再次工作时将其粘贴回去。
The thing is that I always get error that my tables don't exist although when I type show tables; 问题是,尽管我键入show表,但我总是会得到表不存在的错误。 it lists them.
它列出了它们。
mysql> show tables;
+--------------------------+
| Tables_in_database_name |
+--------------------------+
| table_name |
+--------------------------+
1 row in set (0.00 sec)
I get the error when I type something like this for example: 例如,当我输入类似以下内容时,我会收到错误消息:
describe table_name;
ERROR 1146 (42502): Table 'database_name.table_name' doesn't exist
Is there a way to fix this or what would be the proper way to backup my database? 有没有办法解决这个问题,或者什么是备份我的数据库的正确方法?
If you used a InnoDB table, and you just copied the database_name file, you will get the crazy error. 如果您使用InnoDB表,并且刚刚复制了database_name文件,则将出现疯狂的错误。
What you need to do is to copy your database_name file along with ib* files. 您需要做的是将您的database_name文件与ib *文件一起复制。 Those ib* files are in the root of the MySQL datadir (like ibdata1, ib_logfile0, or ib_logfile1).
这些ib *文件位于MySQL数据目录的根目录中(例如ibdata1,ib_logfile0或ib_logfile1)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.