views:

116

answers:

2

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.

A: 

Use the GUI interface. There is probably some not-very-printable character in the sessions name.

Or maybe the underlying file on the filesystem was deleted? If so, try creating an empty file named sessions there.

wallyk
Thanks wally but the db is on a linux server so i won't be able to run any gui tools to look at it, i think.
Max Williams
+1  A: 

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

Max Williams