Forums

Drop database

Hi,

I have a corrupt database and want to create a new db with the same name. The mysql console does not allow me to drop the database. The console itself gives me the feature to create a db but not the feature to drop one.

Thank you for your support.

Richard

Have you tried creating a new database and then moving the tables across to there using:

RENAME TABLE old_db.table TO new_db.table;

What's the error that you get when you try to drop the database? What's the exact command you're using to drop it?

The error I get is the following:

mysql> drop database imanops03bdim; ERROR 1044 (42000): Access denied for user 'richdijk'@'%' to database 'imanops03bdim'

I resolved the deadlock by creating a new database with another name. The old db should be removed for obvious reasons. The corruption was caused by enthusiastic db redefinition on my web2py app; migrate has limits apparently.

Richard

Ah, I see the problem -- you need to use the full name of the database when dropping it, including the username$ prefix. So:

drop database richdijk$imanops03bdim;

MySQL is just giving you a rather unhelpful error message, saying that you don't have permission to drop it rather than saying that the DB with that name doesn't exist.