distal-attribute
distal-attribute
distal-attribute
distal-attribute

Database cannot be deleted -- SQL Error 1049: Unknown database

WaveLength posted 3 years ago in General
When I go to localhost, a database called test1 is listed in the left panel. I want to drop it, but when I click on it, I get this error message:

SQL Error (1049): Unknown database test1

If I run

drop database test1

then I get error 1008 ("database doesn't exist")

I have several of these fantom databases, and I'd like to delete them. Is there any way to do that?

Thanks.


ansgar posted 3 years ago
Do these databases show up in a SHOW DATABASES query result?
WaveLength posted 3 years ago
No, they do not appear after a SHOW DATABASES query.
WaveLength posted 3 years ago
I solved the problem, as follows:

Open the Session Manager, select localhost, choose an individual database from the Databases drop-down list, click save, click cancel, exit HeidiSQL, reopen HeidiSQL, select localhost, click Open. The phantom databases are gone.
ansgar posted 3 years ago
Very strange. Where do you think did they appear from?

Dinand posted 6 months ago

thanx WaveLenght, after 3 years, it still is the same problem with the same solution.

ansgar posted 6 months ago

Can somebody please shed some light on where these phantom databases come from??

Dinand posted 6 months ago

Ansgar, The db's are your own old db's . So the check for existing db's should be done with the connect and the problem is solved. But while there is no report button.

WILL ANY ONE TAKE THIS TO THE ISSUE LIST THANX

ansgar posted 6 months ago

Ansgar, The db's are your own old db's

Please explain.

Helleri posted 4 months ago

I accidentally didn't set my new db to utf8_general_ci before saving. So I made another that was like that before continuing (with the tutorial I was watching). But then I wanted to get rid of the useless one so I went to delete it but got this same error. Playing around with stuff I found that in the session manager there is a field that shows what things it intends to load up under a given project (individual items separated by semi-colons within that field). I saw the two that I wanted and in between them the one that I didn't. So I highlighted it and removed it (and its semi-colon) from that list. and when I went to open it asked me to save the change, which I did. The project opened with out the part I didn't want and things have gone smoothly thus far from there.

FYI: I have absolutely no idea what I am doing (Youtube tutorials are what get me through) but it seems like my problem was similar, and my problem seems to be resolved, so hopefully that is helpful.

curtisweeks posted 2 months ago

Had this issue except the phantom database would appear in a SHOW DATABASES query.

mysql> SHOW DATABASES;

+--------------------+
| Database           |
+--------------------+
| information_schema |
|  phantom_database  |
| another_database   |
+--------------------+

Notice there is a space in the database name (not sure how it got there, I dropped and recreated the database so it may have been a typo) seemed to be what was preventing HeidiSQL from deleting the database. From the CLI, single quotes and escape characters would not work for the DROP command, only backticks:

DROP DATABASE ` phantom_database`;

Please login to leave a reply, or register at first.