One of our users has deleted a table by mistake. How can I restore only that table?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
I'm not familiar with MySQL, so don't have a straight line of directions. What I'd do is to restore the last backup (do you have one?) of the database on the same or a different server and copy the missing table table to the main on-line database.
PS: oh, and also remove the write permission for that user :-).
If you've got a backup dump of the DB, there's a nice article on the alternatives here. http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump
Most commonly you want to extract the relevant data and exclude data on the rest of the tables.
If you have binlogs, you'll most likely need to create a temporary copy of the whole DB and replay from the last dump.
Step1: create a user who has privilege to read / write only that particular drop table in the database.
Step2: restore forcefully from your backup (.sql ) file by logging that user .
Step3: Now check database and that table.