table does not exist after succesfull creation

133 Views Asked by At

I used MySQL through command line in order to create a database named javafxsample. The code is as folls:

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)
); 

The database javafxsample is created successfully in MySQL command line. (I know this because I can see it using SHOW DATABASES;.) However, when I try to see it using DESCRIBE javafxsample;, I got this error message:

ERROR 1146 (42S02): Table 'javafxsample.javafxsample' doesn't exist.

I do not know how to solve this issue, nor why I can not see the table javafxsample. I am using MySQL server version 5.7.24. Any help or suggestion(s) in order to get this table work is really appreciated.

2

There are 2 best solutions below

0
On

javafxsample is your database. you cannot use describe on database.

Try describe user instead

2
On

The error "ERROR 1146 (42S02): Table 'javafxsample.javafxsample' doesn't exist" says table "javafxsample" does not exists in "javafxsample" database.

You create database "javafxsample" and table "user".

So try describing your user table like DESCRIBE user