Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

One of our users has deleted a table by mistake. How can I restore only that table?

share|improve this question
    
The answer to this problem would depend on 1. the table engine (myisam or innodb) you are using, and 2. the type of backup method that you are using (text backups or binary backups). If you can answer these two questions then only would I be able to tell you the exact method of restoring the table. –  ovais.tariq May 6 '11 at 12:41
add comment

3 Answers

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 :-).

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.