首页 > 解决方案 > 创建成功后表不存在

问题描述

我通过命令行使用 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)
); 

javafxsample在 MySQL 命令行中成功创建数据库。(我知道这一点是因为我可以使用SHOW DATABASES;.DESCRIBE javafxsample;

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

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

标签: mysqlmysql-error-1146

解决方案


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

试试describe user


推荐阅读