Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drop screwed up table in Mysql db

I've managed to corrupt (or something) the 'sessions' table in a mysql db i have (which is called "e_learning_resource_prelive"). This wouldn't be a problem normally as i could just go back to a backup dump of the db. However, the corrupted table seems to be stopping me deleting the database:

> mysqladmin -u root drop e_learning_resource_prelive
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.

Do you really want to drop the 'e_learning_resource_prelive' database [y/N] y
mysqladmin: DROP DATABASE e_learning_resource_prelive failed;
error: 'Unknown table 'sessions''

When i go into the db the sessions table shows up in show_tables (it's the only one there, the mysqladmin drop deleted the rest) but i can't drop it:

mysql> show tables;
+---------------------------------------+
| Tables_in_e_learning_resource_prelive |
+---------------------------------------+
| sessions                              | 
+---------------------------------------+
1 row in set (0.00 sec)

mysql> drop table sessions;
ERROR 1051 (42S02): Unknown table 'sessions'

Can anyone tell me how i can delete this table, or the whole db? I need to delete the db and then rebuild it from my backup dump.

like image 218
Max Williams Avatar asked Jan 05 '10 19:01

Max Williams


1 Answers

Figured it out, seems kind of obvious now. The dbs all just have a folder which can be deleted like anything else.

sudo rm -r /var/lib/mysql/e_learning_resource_prelive

Thanks anyone who looked, anyway :) max

like image 193
Max Williams Avatar answered Nov 15 '22 04:11

Max Williams