Yes this is an old db (we are in the process of migrating). Somehow, phpMyAdmin let a user create a table with a ' in it.
name: type_save'
But, I cannot seem to drop that table now. I have tried this from the commandline:
mysql> drop table "type_save\'";
ERROR 1064: You have an error in your SQL syntax near '"type_save\'"' at line 1
mysql> drop table "type_save'";
ERROR 1064: You have an error in your SQL syntax near '"type_save'"' at line 1
mysql> drop table `type_save'`;
'>
How do you properly escape this?
Thanks...
According to Does MySQL allows to create database with dot? you use backticks to quote the name, as in
drop table `type_save'`
Try that and see if it helps.
Try this:
mysql> drop table `type_save'`;
Note: "mysql>" is only the command prompt.
Character is ` (reverse apostrophe or left single quote).
It's MySQL 3.x, so it's very likely MyISAM (or even ISAM). Since the normal way to drop the table isn't working (since you say it crashes the server), and if it's MyISAM/ISAM, just delete the relevant .MYI
, .MYD
, and .frm
files straight from the filesystem, or move them elsewhere if you need to preserve them for some reason. Then do a flush tables. You don't even need to shut down the server (at least on Unix, on Windows the file may be in use and Windows may not let you delete it. Flush tables may help).
Do not do this if its InnoDB, only ISAM or MyISAM.
If its InnoDB, I'm afraid you may have a dump/reload in your future.
And have backups, of course. Always have backups.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With