Mike
Mike

Reputation: 6934

Restore deleted database

I just deleted two days of work because I though I had a backup, but I didn't. Now I need to create the database from scratch and I just wonder, isn't there a built-in backup system, just in case of someone being stupid? It's running on localhost and I haven't exported it out before.

Upvotes: 1

Views: 12997

Answers (4)

Vivek Siddharth
Vivek Siddharth

Reputation: 41

Install the MySQL Workbench:-

  1. On left side panel (i.e. under the Administration section), you will find the option to "Data Import/Restore".
  2. On click, you will land on the Data Import. Select the option "Import from Dump Project Folder" and then select the file based on TimeStamp of that duration when the database was deleted.
  3. Click on "Load Folder Content"
  4. Select database object to import, check whether the deleted database is visible or not.

If visible then select all the tables and click on start import button.

If not visible then start with step 2 again and one by one select all the dump files.

At least I was able to recover all my database which accidentally got deleted during the database restore (i.e. initialization process). This has saved my weeks of effort.

Upvotes: 0

Mchl
Mchl

Reputation: 62395

If you've had binary logging enabled, then you might be lucky enough to use it to restore your database.

Note: If you ask me 'how do I know if I had binary logging enabled?' this pretty much means you didn't, because it's disabled by default.

Upvotes: 2

Álvaro González
Álvaro González

Reputation: 146660

There are several options. They're covered in detail at http://dev.mysql.com/doc/refman/5.1/en/backup-and-recovery.html

If you are developing some kind of app, I'd also recommend to store your DB structure in your version control system together with your source code.

Upvotes: 2

Piskvor left the building
Piskvor left the building

Reputation: 92792

No.

Computers will do anything you command them to - but it is your responsibility to know what you're doing.

In this way, "if you wanted backups, you would have made them" - power-user tools (such as databases) are optimized for performance, not for being user-proof.

Upvotes: 1

Related Questions