Database cannot be deleted -- SQL Error 1049: Unknown database
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.
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.
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.
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.