0
CREATE TABLE User(
    id INT PRIMARY KEY,
    names VARCHAR(100),
    aling VARCHAR(30),
    eye VARCHAR(30),
    hair VARCHAR(30),
    gender VARCHAR(30),
    apperences INT,
    year INT,
    universal VARCHAR(10)
)

everywhere I look, such an example is shown... and nowhere does it say how to choose a database. even with a direct request

21:42:26

CREATE TABLE User(
   id INT PRIMARY KEY,
   names VARCHAR(100),
   aling VARCHAR(30),
   eye VARCHAR(30),
   hair VARCHAR(30),
   gender VARCHAR(30),
   apperences INT,
   year INT,
   universal VARCHAR(10)
)

Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. 0.000 sec

I expected that I would just write and everything would work, but no

Akina
  • 39,301
  • 5
  • 14
  • 25
Evgeni
  • 1
  • 3
  • 2
    https://dev.mysql.com/doc/refman/8.0/en/use.html from query window. Also Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar seems starightforward what ui are you using and can you see the sidebar? Have you CREATED a database before attempting to create table? – P.Salmon Dec 21 '22 at 11:50
  • Either set default database (USE statement, see above) or specify the database where the table must be created in: `CREATE TABLE MyDatabase.User( ..` – Akina Dec 21 '22 at 11:57
  • that's it, there are no problems. thanks for the link – Evgeni Dec 21 '22 at 12:24

0 Answers0