网站搬迁导入数据库提示错误 1146 (42S02) at line 9592: Table 'pre_ucenter_pm_messages_9' doesn't exist 的解决办法
问题现象:通过复制直接MySQL数据库目录中的表文件进行搬迁数据库,搬完后提示错误ERROR 1146 (42S02): Table doesn't exist。比如直接复制原宝塔数据库目录/www/server/data/[数据库名]/中的文件进行数据库迁移后,PHPmyadmin面板会提示这个错误。
或者从另外一台服务器的宝塔面板备份数据库后下载,然后在第二台服务器的宝塔面板中创建数据库并导入备份时,提示错误:
ERROR 1146 (42S02) at line 9592: Table 'xxx_cn.pre_ucenter_pm_messages_9' doesn't exist ERROR 1050 (42S01) at line 9602: Table '.' already exists ERROR 1146 (42S02) at line 9616: Table 'xxx_cn.pre_ucenter_protectedmembers' doesn't exist ERROR 1146 (42S02) at line 9617: Table 'xxx_cn.pre_ucenter_protectedmembers' doesn't exist ERROR 1146 (42S02) at line 9618: Table 'xxx_cn.pre_ucenter_protectedmembers' doesn't exist ERROR 1050 (42S01) at line 9628: Table '.' already exists ERROR 1146 (42S02) at line 9639: Table 'xxx_cn.pre_ucenter_settings' doesn't exist ERROR 1146 (42S02) at line 9640: Table 'xxx_cn.pre_ucenter_settings' doesn't exist ERROR 1146 (42S02) at line 9641: Table 'xxx_cn.pre_ucenter_settings' doesn't exist ERROR 1146 (42S02) at line 9642: Table 'xxx_cn.pre_ucenter_settings' doesn't exist ERROR 1050 (42S01) at line 9652: Table '.' already exists ERROR 1146 (42S02) at line 9665: Table 'xxx_cn.pre_ucenter_sqlcache' doesn't exist ERROR 1146 (42S02) at line 9666: Table 'xxx_cn.pre_ucenter_sqlcache' doesn't exist ERROR 1146 (42S02) at line 9667: Table 'xxx_cn.pre_ucenter_sqlcache' doesn't exist ERROR 1050 (42S01) at line 9677: Table '.' already exists ERROR 1146 (42S02) at line 9690: Table 'xxx_cn.pre_ucenter_tags' doesn't exist ERROR 1146 (42S02) at line 9691: Table 'xxx_cn.pre_ucenter_tags' doesn't exist ERROR 1146 (42S02) at line 9692: Table 'xxx_cn.pre_ucenter_tags' doesn't exist ERROR 1050 (42S01) at line 9702: Table '.' already exists ERROR 1146 (42S02) at line 9713: Table 'xxx_cn.pre_ucenter_vars' doesn't exist ERROR 1146 (42S02) at line 9714: Table 'xxx_cn.pre_ucenter_vars' doesn't exist ERROR 1146 (42S02) at line 9715: Table 'xxx_cn.pre_ucenter_vars' doesn't exist ['ERROR 1146 (42S02): 数据库或表不存在!'] |-导入状态:异常 请检查数据是否完整、并根据上述错误信息进行排错 |-导入结束时间:2025-01-23 15:08:56 |-导入总耗时:3秒 ===================================================== Database recovery error!
问题原因及解决办法:提示表不存在,很有可能是因为出现这个错误是由于迁移的时候没有把mysql目录中的ibdata1文件拷贝过来;(宝塔的数据库目录是:/www/server/data/)如果拷贝过来后,要给ibdata1文件正确读写权限660,以及设置所有者为MySQL,否则可能导致MySQL服务不启动(见下图示);如果做完以上两项还不正确,删除ib_logfile0、ib_logfile1这两个文件,然后重启服务器一下就可以了。
扫描二维码推送至手机访问。
版权声明:本文由 声光视趣 - blog.lavfun.com 发布,如需转载请注明出处。