导入数据库phpmyadmin [英] import database phpmyadmin

查看:107
本文介绍了导入数据库phpmyadmin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经导出了数据库,但是每次导入时,我都会得到一个错误,我相信是因为数据库中存在外键

I have been given an export of a database but when ever i import i get an error that i believe is because foreign keys exist in the database

SQL query:

--
-- Constraints for dumped tables
--
--
-- Constraints for table `instance`
--
ALTER TABLE  `instance` ADD CONSTRAINT  `instance_ibfk_2` FOREIGN KEY (  `user_id` ) REFERENCES  `user` (  `id` ) ,
ADD CONSTRAINT  `instance_ibfk_1` FOREIGN KEY (  `cat_id` ) REFERENCES  `category` (  `cat_id` ) ;


MySQL said: 

#1005 - Can't create table 'dalejc.#sql-152c_243' (errno: 150) 

推荐答案

您的猜测可能是正确的.尝试按照 http://上的建议获取详细的错误消息: //dev.mysql.com/doc/refman/5.5/zh-CN/innodb-foreign-key-constraints.html

Your guess is probably right. Try getting a detailed error message as suggested at http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html

类似地,如果ALTER TABLE失败并且 它指的是错误150,这意味着 外键定义为 为修改后的格式不正确 桌子.您可以使用SHOW ENGINE INNODB 状态显示详细 最新的InnoDB的解释 服务器中的外键错误.

Similarly, if an ALTER TABLE fails and it refers to error 150, that means a foreign key definition would be incorrectly formed for the altered table. You can use SHOW ENGINE INNODB STATUS to display a detailed explanation of the most recent InnoDB foreign key error in the server.

这篇关于导入数据库phpmyadmin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆