是否在配置文件里skip-innodb了

解决方案 »

  1.   

    --innodb 
    Enables the InnoDB storage engine, if the server was compiled with InnoDB support. Use --skip-innodb to disable InnoDB.
      

  2.   

    我们用的是mysql 5 默认就是innodb,我们也没有去改动默认的配置文件。现在找到原因了。
    但是又出了点问题
    create table a (id1 int not null,name varchar(20),primary key(id1))type=InnoDB;
    create table b(id2 int not null,lessonname varchar(20),primary key(id2))type=InnoDB;alter table b
        add constraint FK 
        foreign key (lessonname) 
        references a(name);
    像上面的语句,alter语句会报错,去掉create的type=InnoDB
    就成功,这个怎么解决?我们一定要显示的申明InnoDB。求教
      

  3.   

    alter table b add FOREIGN KEY id (id2) references a(id1);id1 id2 需要是索引列语法
    ALTER TABLE tbl_name
        ADD [CONSTRAINT symbol] FOREIGN KEY [id] (index_col_name, ...)
        REFERENCES tbl_name (index_col_name, ...)
        [ON DELETE {RESTRICT | CASCADE | SET NULL | NO ACTION}]
        [ON UPDATE {RESTRICT | CASCADE | SET NULL | NO ACTION}]
      

  4.   

    create table a (id1 int not null,name varchar(20),primary key(id1)) engine=innodb;
    create table b(id2 int not null,lessonname varchar(20),primary key(id2)) engine=innodb;alter table b
        add index FK  (lessonname), 
        add constraint FK 
        foreign key (lessonname) 
        references a (name);
    这样还是不行啊!还是alter出错 ERROR 1005: Can't create table '.\test\#sql-c6c_d.frm' (errno: 150)
      

  5.   

    首先它默认安装的数据库引擎是MYSIAM,你可以在配置文件里设置启动什么类型的。
    如果你的引擎是默认的MYISAM:  
    CREATE TABLE `address` (
      `address_id` bigint(20) NOT NULL auto_increment,
      `ip_address` varchar(255) NOT NULL default '',
      `type` int(11) NOT NULL default '0',
      `rule_id` bigint(20) NOT NULL default '0',
      PRIMARY KEY  (`address_id`),
      KEY `FKBB979BF42AEABE09` (`rule_id`)
    ) ENGINE=innodb DEFAULT CHARSET=latin1;
    执行这个教本后,这个表的属性还是INNODB的,可是你数据库的引擎是MYISAM,也就是说他没有什么意义。如果你是用其它的工具,不选的话,它默认就是数据库引擎的属性。
    还有,你字符集用的是LATION1,我认为你不要用它,对以后的迁移不好。