Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 无法创建表errno150_Mysql_Xampp - Fatal编程技术网

Mysql 无法创建表errno150

Mysql 无法创建表errno150,mysql,xampp,Mysql,Xampp,我在创建表时出错“register”。。。 共有5个表astro-info,期望值,家庭背景,个人信息,服务业务 我已经检查了所有外键的数据类型和大小。它们是一样的。也就是说,对于其他表中的所有灵长类键,bigint(100)。但我还是得到了这个错误 请帮忙 这是我的桌子结构 create table register( register_id bigint(100) primary key, mv_id bigint(100), astro_id bigint(100)

我在创建表时出错
“register”
。。。 共有5个表
astro-info
期望值
家庭背景
个人信息
服务业务

我已经检查了所有外键的数据类型和大小。它们是一样的。也就是说,对于其他表中的所有灵长类键,
bigint(100)
。但我还是得到了这个错误

请帮忙

这是我的桌子结构

create table register(
    register_id bigint(100) primary key,
    mv_id bigint(100),
    astro_id bigint(100),
    foreign key(astro_id) 
            references `astro-info`(astro_id),
    expectation_id bigint(100),
    foreign key(expectation_id) 
            references `expectations`(expectation_id),
    familybackground_id bigint(100),
    foreign key(familybackground_id) 
            references `familybackground`(familybackground_id),
    personal_info_id bigint(100),
    foreign key(personal_info_id) 
            references `personal_info`(personal_info_id),
    service_id bigint(100),
    foreign key(service_id) 
            references `service-business`(service_id));
表的表结构
astro info
期望值的表结构
表的表结构
familybackground
个人信息的表结构
表
服务业务的表结构

您的表中有一个错误
astro info

CREATE TABLE IF NOT EXISTS `astro-info` (
  ` astro_id` bigint(100) NOT NULL AUTO_INCREMENT,
  -- other irrelevant fields removed from here
  PRIMARY KEY (` astro_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
错误出现在两个地方:

  ` astro_id` bigint(100) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (` astro_id`)
它有一个带有列名的前导空格。在
regster
表中的列上定义外键时,没有使用相同的方法

create table register(
    register_id bigint(100) primary key,
    mv_id bigint(100),
    astro_id bigint(100),
    foreign key(astro_id) 
            references `astro-info`(astro_id),
    expectation_id bigint(100),
    foreign key(expectation_id) 
            references `expectations`(expectation_id),
    familybackground_id bigint(100),
    foreign key(familybackground_id) 
            references `familybackground`(familybackground_id),
    personal_info_id bigint(100),
    foreign key(personal_info_id) 
            references `personal_info`(personal_info_id),
    service_id bigint(100),
    foreign key(service_id) 
            references `service-business`(service_id));
此定义在
寄存器
表中

    astro_id bigint(100),
    foreign key(astro_id) 
            references `astro-info`(astro_id),
astro info
表中的以下定义不匹配

  ` astro_id` bigint(100) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (` astro_id`)
解决方案
选项1:在
astro info
表格中将
`astro\u id`
重新定义为
`astro\u id`

create table register(
    register_id bigint(100) primary key,
    mv_id bigint(100),
    astro_id bigint(100),
    foreign key(astro_id) 
            references `astro-info`(astro_id),
    expectation_id bigint(100),
    foreign key(expectation_id) 
            references `expectations`(expectation_id),
    familybackground_id bigint(100),
    foreign key(familybackground_id) 
            references `familybackground`(familybackground_id),
    personal_info_id bigint(100),
    foreign key(personal_info_id) 
            references `personal_info`(personal_info_id),
    service_id bigint(100),
    foreign key(service_id) 
            references `service-business`(service_id));
选项2:重新定义astro_id
以使其具有前导空格。如
`astro\u id`
所示


我的建议是使用选项1,修改
astro info
表字段。

150
是外键映射失败。以上哪些定义失败?你也可以发布所有
参考
表格的表格结构吗?@Ravinder请检查编辑的问题…谢谢你的宝贵时间…它适合我。。。我已经修改了“天文信息”表。。现在开始工作了…:丹克斯。。。。
  ` astro_id` bigint(100) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (` astro_id`)
create table register(
    register_id bigint(100) primary key,
    mv_id bigint(100),
    astro_id bigint(100),
    foreign key(astro_id) 
            references `astro-info`(astro_id),
    expectation_id bigint(100),
    foreign key(expectation_id) 
            references `expectations`(expectation_id),
    familybackground_id bigint(100),
    foreign key(familybackground_id) 
            references `familybackground`(familybackground_id),
    personal_info_id bigint(100),
    foreign key(personal_info_id) 
            references `personal_info`(personal_info_id),
    service_id bigint(100),
    foreign key(service_id) 
            references `service-business`(service_id));
    astro_id bigint(100),
    foreign key(astro_id) 
            references `astro-info`(astro_id),
  ` astro_id` bigint(100) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (` astro_id`)