mysql integrityerror__mysql_exceptions.IntegrityError:(1215,'Cannot add foreign key constraint')...

我使用Ontonotes数据库工具,但遇到问题 .

我读了它的文档,它说这个工具在mysql 5.0上运行良好 . 但是,我找不到这个版本 . 所以,我安装了mysql 5.7 . 出现此问题,问题是这样的:

python on/tools/init_db.py --init ontonotes localhost root ontonotes-release-4.0/

初始化DB ...

/Users/anaconda/lib/python2.7/site-packages/on/init.py:525:警告:未知表'ontonotes.tree'cursor.execute(“”“删除表,如果存在%s;”“” %thing.sql_table_name)

create table tree

(

id varchar(255) not null collate utf8_bin primary key,

parent_id varchar(255),

document_id varchar(255),

word varchar(255),

child_index int,

start int not null,

end int not null,

coref_section int not null,

syntactic_link_type varchar(255),

tag varchar(255) not null,

part_of_speech varchar(255),

phrase_type varchar(255),

function_tag_id varchar(255),

string longtext,

no_trace_string longtext,

parse longtext,

foreign key (parent_id) references tree.id,

foreign key (document_id) references document.id,

foreign key (syntactic_link_type) references syntactic_link_type.id,

foreign key (part_of_speech) references pos_type.id,

foreign key (phrase_type) references phrase_type.id,

foreign key (function_tag_id) references compound_function_tag.id

)

default character set utf8;

Traceback(最近一次调用最后一次):文件“on / tools / init_db.py”,第81行,在on.ontonotes.initialize_db(a_cursor)文件“/Users/anaconda/lib/python2.7/site-packages/on /init.py“,第528行,在initialize_db cursor.execute(thing.sql_create_statement)文件”/Users/anaconda/lib/python2.7/site-packages/MySQLdb/cursors.py“,第205行,执行self . errorhandler(self,exc,value)文件“/Users/anaconda/lib/python2.7/site-packages/MySQLdb/connections.py”,第36行,在defaulterrorhandler中引发错误类,errorvalue _mysql_exceptions.IntegrityError:(1215,'不能添加外键约束')

并且已经创建了三个表:

create table ontonotes

(

id varchar(255) not null primary key

)

default character set utf8;

create table subcorpus

(

id varchar(255) not null primary key,

base_dir varchar(255) not null,

top_dir varchar(255) not null,

root_dir varchar(255) not null,

language_id varchar(255) not null,

encoding_id varchar(255) not null,

ontonotes_id varchar(255) not null

)

default character set utf8;

create table file

(

id varchar(255) not null primary key,

base_dir varchar(255) not null,

physical_filename varchar(255) not null,

document_id varchar(255) not null,

file_type varchar(255) not null,

subcorpus_id varchar(255) not null

)

default character set utf8;

我真的不知道如何解决这个问题,因为我对mysql不熟悉 . 有人可以帮帮我,还是给我一个mysql 5.0版本(linux 64bit / mac 64bit)?非常想你!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值