【问题标题】:table does not exist after succesfull creation创建成功后表不存在
【发布时间】:2019-08-03 18:31:35
【问题描述】:

我通过命令行使用 MySQL 来创建一个名为 javafxsample 的数据库。代码如下:

create database javafxsample;
use javafxsample;

create table if not exists user(
    id int(11) not null auto_increment,
    username varchar(255) not null unique,
    last_name varchar(255) not null,
    first_name varchar(255) not null,
    password varchar(255) not null,
    created_at datetime not null default current_timestamp,
    primary key(id)
); 

在 MySQL 命令行中成功创建数据库javafxsample。 (我知道这一点是因为我可以使用 SHOW DATABASES; 查看它。)但是,当我尝试使用 DESCRIBE javafxsample; 查看它时,我收到了以下错误消息:

错误 1146 (42S02):表 'javafxsample.javafxsample' 不存在。

我不知道如何解决这个问题,也不知道为什么我看不到表javafxsample。我正在使用 MySQL 服务器版本 5.7.24。任何帮助或建议,以得到这个表工作真的很感激。

【问题讨论】:

标签: mysql mysql-error-1146


【解决方案1】:

javafxsample 是您的数据库。您不能在数据库上使用描述。

改用describe user

【讨论】:

    【解决方案2】:

    错误“ERROR 1146 (42S02): Table 'javafxsample.javafxsample' doesn't exist”表示“javafxsample”数据库中不存在表“javafxsample”。

    您创建数据库“javafxsample”和表“user”。

    所以试着像DESCRIBE user这样描述你的用户表

    【讨论】:

    • 我已经使用了“DESCRIBE user”,最后我得到了我的表javafxsample的信息,没有创建一个名为“user”的新表,它可以看到表内的元素,非常感谢!! !
    • 非常感谢您的帮助,谢谢,我已经解决了这个问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-10
    • 2023-03-21
    • 2015-10-05
    • 1970-01-01
    • 1970-01-01
    • 2012-09-14
    相关资源
    最近更新 更多