• <bdo id='EEbcI'></bdo><ul id='EEbcI'></ul>

    <tfoot id='EEbcI'></tfoot>
    <legend id='EEbcI'><style id='EEbcI'><dir id='EEbcI'><q id='EEbcI'></q></dir></style></legend>

    1. <small id='EEbcI'></small><noframes id='EEbcI'>

      <i id='EEbcI'><tr id='EEbcI'><dt id='EEbcI'><q id='EEbcI'><span id='EEbcI'><b id='EEbcI'><form id='EEbcI'><ins id='EEbcI'></ins><ul id='EEbcI'></ul><sub id='EEbcI'></sub></form><legend id='EEbcI'></legend><bdo id='EEbcI'><pre id='EEbcI'><center id='EEbcI'></center></pre></bdo></b><th id='EEbcI'></th></span></q></dt></tr></i><div id='EEbcI'><tfoot id='EEbcI'></tfoot><dl id='EEbcI'><fieldset id='EEbcI'></fieldset></dl></div>

      1. #1005 - 无法创建表“table_name"(错误号:150)

        时间:2023-06-06

          • <bdo id='ArCYv'></bdo><ul id='ArCYv'></ul>
            <legend id='ArCYv'><style id='ArCYv'><dir id='ArCYv'><q id='ArCYv'></q></dir></style></legend>
            • <i id='ArCYv'><tr id='ArCYv'><dt id='ArCYv'><q id='ArCYv'><span id='ArCYv'><b id='ArCYv'><form id='ArCYv'><ins id='ArCYv'></ins><ul id='ArCYv'></ul><sub id='ArCYv'></sub></form><legend id='ArCYv'></legend><bdo id='ArCYv'><pre id='ArCYv'><center id='ArCYv'></center></pre></bdo></b><th id='ArCYv'></th></span></q></dt></tr></i><div id='ArCYv'><tfoot id='ArCYv'></tfoot><dl id='ArCYv'><fieldset id='ArCYv'></fieldset></dl></div>

                <small id='ArCYv'></small><noframes id='ArCYv'>

                    <tbody id='ArCYv'></tbody>
                1. <tfoot id='ArCYv'></tfoot>
                2. 本文介绍了#1005 - 无法创建表“table_name"(错误号:150)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  这是我的表:

                  DROP TABLE IF EXISTS `tbl_comments`;
                  CREATE TABLE IF NOT EXISTS `tbl_comments` (
                    `id` int(11) NOT NULL auto_increment,
                    `topic_id` int(11) NOT NULL,
                    `user_id` int(11) NOT NULL,
                    `text` text NOT NULL,
                    `create_dt` datetime NOT NULL,
                    `update_dt` timestamp NULL default CURRENT_TIMESTAMP,
                    PRIMARY KEY  (`id`),
                    KEY `topic_id_2` (`topic_id`),
                    KEY `user_id` (`user_id`),
                    CONSTRAINT `tbl_comments_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`id`),
                    CONSTRAINT `tbl_comments_ibfk_1` FOREIGN KEY (`topic_id`) REFERENCES `tbl_topics` (`id`)
                  ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
                  
                  
                  DROP TABLE IF EXISTS `tbl_users`;
                  CREATE TABLE IF NOT EXISTS `tbl_users` (
                    `id` int(11) NOT NULL auto_increment,
                    `username` varchar(20) NOT NULL default '',
                    `password` varchar(128) NOT NULL default '',
                    `email` varchar(128) NOT NULL default '',
                    `activkey` varchar(128) NOT NULL default '',
                    `superuser` int(1) NOT NULL default '0',
                    `status` int(1) NOT NULL default '0',
                    `create_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
                    `lastvisit_at` timestamp NOT NULL default '0000-00-00 00:00:00',
                    PRIMARY KEY  (`id`),
                    UNIQUE KEY `user_username` (`username`),
                    UNIQUE KEY `user_email` (`email`)
                  ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
                  
                  
                  DROP TABLE IF EXISTS `tbl_topics`;
                  CREATE TABLE IF NOT EXISTS `tbl_topics` (
                    `id` int(11) NOT NULL auto_increment,
                    `group_id` int(11) NOT NULL,
                    `user_id` int(11) NOT NULL,
                    `header` varchar(255) NOT NULL,
                    `text` text NOT NULL,
                    `create_dt` datetime NOT NULL,
                    `update_dt` timestamp NULL default CURRENT_TIMESTAMP,
                    PRIMARY KEY  (`id`),
                    KEY `user_id` (`user_id`),
                    KEY `group_id` (`group_id`),
                    CONSTRAINT `tbl_topics_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `tbl_groups` (`id`),
                    CONSTRAINT `tbl_topics_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`id`)
                  ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
                  

                  现在我尝试导入时出现错误:#1005 - 无法创建表 'kobeco_yii.tbl_comments' (errno: 150)(详细信息:Percona-XtraDB,支持事务、行级锁定和外键)

                  now i have the error when i try to import: #1005 - Can't create table 'kobeco_yii.tbl_comments' (errno: 150) (Details: Percona-XtraDB, Supports transactions, row-level locking, and foreign keys )

                  推荐答案

                  您正在尝试在其他表之前创建 tbl_comments.tbl_comments 需要表 tbl_userstbl_topics 用于外键约束.

                  You're trying to create tbl_comments before your other tables. tbl_comments requires tables tbl_users and tbl_topics for foreign key constraints.

                  尝试将 tbl_commentsCREATE TABLE 移到其他下方.

                  Try moving the CREATE TABLE for tbl_comments to below the others.

                  这篇关于#1005 - 无法创建表“table_name"(错误号:150)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:编程错误:(1064 ....) 下一篇:Yii:获取每月热门用户和年末热门用户的SQL查询

                  相关文章

                  最新文章

                  1. <i id='9Mo4E'><tr id='9Mo4E'><dt id='9Mo4E'><q id='9Mo4E'><span id='9Mo4E'><b id='9Mo4E'><form id='9Mo4E'><ins id='9Mo4E'></ins><ul id='9Mo4E'></ul><sub id='9Mo4E'></sub></form><legend id='9Mo4E'></legend><bdo id='9Mo4E'><pre id='9Mo4E'><center id='9Mo4E'></center></pre></bdo></b><th id='9Mo4E'></th></span></q></dt></tr></i><div id='9Mo4E'><tfoot id='9Mo4E'></tfoot><dl id='9Mo4E'><fieldset id='9Mo4E'></fieldset></dl></div>
                    <tfoot id='9Mo4E'></tfoot>
                    <legend id='9Mo4E'><style id='9Mo4E'><dir id='9Mo4E'><q id='9Mo4E'></q></dir></style></legend>

                  2. <small id='9Mo4E'></small><noframes id='9Mo4E'>

                    • <bdo id='9Mo4E'></bdo><ul id='9Mo4E'></ul>