标签: mysql-error-1050

Mysql 1050错误"表已经存在",实际上它没有

我正在添加这个表:

CREATE TABLE contenttype (
        contenttypeid INT UNSIGNED NOT NULL AUTO_INCREMENT,
        class VARBINARY(50) NOT NULL,
        packageid INT UNSIGNED NOT NULL,
        canplace ENUM('0','1') NOT NULL DEFAULT '0',
        cansearch ENUM('0','1') NOT NULL DEFAULT '0',
        cantag ENUM('0','1') DEFAULT '0',
        canattach ENUM('0','1') DEFAULT '0',
        isaggregator ENUM('0', '1') NOT NULL DEFAULT '0',
        PRIMARY KEY (contenttypeid),
        UNIQUE KEY packageclass (packageid, class)
);
Run Code Online (Sandbox Code Playgroud)

我得到一个1050"桌子已经存在"

但该表不存在.有任何想法吗?

编辑:更多细节,因为每个人似乎都不相信我:)

DESCRIBE contenttype
Run Code Online (Sandbox Code Playgroud)

收益率:

1146 - 表'gunzfact_vbforumdb.contenttype'不存在

CREATE TABLE gunzfact_vbforumdb.contenttype(
contenttypeid INT UNSIGNED NOT NULL AUTO_INCREMENT ,
class VARBINARY( 50 ) …
Run Code Online (Sandbox Code Playgroud)

mysql sql mysql-error-1050 mysql-error-1146

69
推荐指数
5
解决办法
21万
查看次数

MySQL"CREATE TABLE IF NOT NOT EXISTS" - >错误1050

使用命令:

CREATE TABLE IF NOT EXISTS `test`.`t1` (
    `col` VARCHAR(16) NOT NULL
) ENGINE=MEMORY;
Run Code Online (Sandbox Code Playgroud)

在MySQL Query Browser中运行两次会导致:

表't1'已存在错误1050

我原本以为创建表"IF NOT EXISTS"不会抛出错误.我错过了什么或这是一个错误吗?我正在运行5.1版.谢谢.

mysql sql mysql-error-1050

57
推荐指数
4
解决办法
17万
查看次数

将外键添加到现有表中会出现错误1050表

我有一个包含列的表CustomizationSet:

customization_set_guid (which is a non-nullable guid and also the primary key)
creator_account_guid
and a few others
Run Code Online (Sandbox Code Playgroud)

和包含现有数据的表注册列:

registration_id (an int and the primary key)
customization_set_guid (also a guid (so a char(36)) which is nullable, and all entries are currently null)
and a few other columns
Run Code Online (Sandbox Code Playgroud)

当我试着跑

ALTER TABLE Registration ADD FOREIGN KEY 
    (
        customization_set_guid
    ) REFERENCES CustomizationSet (
        customization_set_guid
    );
Run Code Online (Sandbox Code Playgroud)

在MySQL Workbench中,它给出了错误1050Table'.\ dbname\registration'已经存在.

如果我尝试使用UI使用Alter Table对话框的Foreign Keys选项卡添加外键,并选择CustomizationSet作为引用表,则不允许我在列列表中选择customization_set_guid.

我真的不确定为什么它不会让我添加这个外键.我刚刚在我刚刚添加的表之间成功创建了外键.注册表已经存在了一段时间......

mysql foreign-keys mysql-workbench mysql-error-1050

20
推荐指数
2
解决办法
2万
查看次数