Is there anyway to get my database back?
I've dropped it accidentally.
- 68,316
- 31
- 175
- 255
- 180
- 1
- 9
4 Answers
Technically speaking, you can. There are data recovery companies who are able to recover most, if not all, the data that you've lost. To do this, you should immediately turn off that system and stop using it! Although it might add some additional data corruption to your disk, just switching off the power would be the best way to prevent any more writes to the disk.
Then you have to ship your computer (or just the disk) to a specialized data recovery company. They will carefully recover the data from your disk in an attempt to restore the lost database again. Whether they succeed or not, it will cost you an outrageous amount of cash. It generally depends on their hourly rates and the amount of time they need. If your data is worth $ 10.000 or more then this would be an option. They do get better results if you've immediately stopped using the disk, because every write to the disk could overwrite your deleted data.
Otherwise, see above. Data recovery is something for experts with proper tools and hardware who can make sure nothing else is written to the disk. It's real expensive and time-consuming but it is possible if you have the cash.
- 1,045
- 6
- 13
-
2In other words, deleted files are still on the hard disk, but only until the space is reused. – kmarsh Aug 25 '09 at 12:20
-
Thank you. But in my case it was just a small database for developing purpose. So I've made another one in matter an hour. – Omar Al-Ithawi Aug 25 '09 at 13:27
-
Yeah, I expected it to be not worth this much trouble. Still, it's good to know if you ever screw up a more expensive database. :-) – Wim ten Brink Aug 25 '09 at 14:33
If you don't have any backups or binlogs, no.
- 8,235
- 1
- 30
- 44
-
It's a LAMMP (XAMPP on Linux) server. Does it have a binlogs? bcuz I don't have backup :( – Omar Al-Ithawi Aug 25 '09 at 09:38
Yes. You can't get it back without a backup or a dump.
I haven't worked on XAMPP But it should have. This article implies that we have the binlogs.
- 1,063
- 1
- 11
- 16
-
**# log-bin deactivated by default since XAMPP 1.4.11** This in the my.cnf file. Which implies that nothing left. :(, Anyway it's not huge db. I'll make it again. – Omar Al-Ithawi Aug 25 '09 at 10:25
-
1
to avoid this happening again, you need to backup your databases regularly, at least a text dump with mysqldump.
i posted a backup script that backs up every mysql db every day, and keeps the last 30 days worth of backups in How can I back up a table structure but NOT its data in MySQL
feel free to modify it for your own needs. and remember to set up a nightly cron job to run it. you can also run it from the command line just before you do anything risky to the db.