0

I haven't used MySQL for a while, so forgive me if this is a silly issue with a simple solution. I have checked similar questions on the site, and in the majority of cases, the asker simply forgot to create or specify the database. This is not the case here.

I get the message

 Error: #1046 No database selected

After running the following instruction

 USE db_name;

For example:

 USE test;

I've tried several databases, but I get the same error with all of them. Creating databases works, that is, the database is created, but the same error message is still shown. If I try to SELECT * on a table from an existing database after specifying it:

USE db_name;
SELECT * FROM table_name;

I get the error:

#1146 - Table 'db_name.table_name' doesn't exist

I'm using MariaDB, version 10.4.14 with root user.

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • that means there is no `table_name` in db you selected before - as the error stated: Table 'db_name.table_name' doesn't exist – Seti Nov 25 '20 at 08:03
  • I'm looking right at the table on the database list in the left side menu. The table exists. And it's not the main issue anyway. – Kotoamatsukami Nov 25 '20 at 08:22
  • Have you stopped and restarted everything? – P.Salmon Nov 25 '20 at 08:48
  • @P.Salmon I did. The error message #1046 is still shown, but at least the query is executed, and I get the table content. I also get the error Error: #145 Table '.\db_name\table_name' is marked as crashed and should be repaired – Kotoamatsukami Nov 25 '20 at 10:12
  • 1
    How to solve the crashed table is answered here: https://stackoverflow.com/questions/4357270/table-is-marked-as-crashed-and-should-be-repaired – Luuk Nov 25 '20 at 12:02

0 Answers0