0

I exported sql file with tables schema without any data inside. Then I wanted to import it to another, empty database, so that it will create empty tables there.

The problem is it imported the file in the first database, non-empty, and thus, it restored the tables to the empty state.

So now all of my tables are empty.

So again, I exported empty tables sql file from staging database, and imported them to fresh, empty database. But instead the file was imported, accidentaly, to the staging database, and all data was removed.

I checked "default target schema" in import options to the right database, so I don't know what went wrong here.

My question is - is there a way to resotre the removed data?

0

1 Answer 1

1

This is very bad news for your database. Your import file dropped your tables with lots of data and recreated them containing no rows. Ouch.

If you have a backup, restore it.

If you don't have a backup, you may (or may not) be able to restore some of your data by recovering deleted files. Your luck will be better if you used separate files for your InnoDB tables, or if you used MyISAM. At any rate, shut down your MySQL server instance and make the server on which it runs as quiet as possible, to reduce the probability that the OS will reclaim the deleted file space.

You'll have to ask on https://serverfault.com/ for further advice.

There is no escaping that this event will be difficult to recover from.

Sign up to request clarification or add additional context in comments.

3 Comments

Well it's a staging database, so I can always just copy part of the production database. But I don't have the access to production database right now, that's why I asked this question. Thanks!
But what's funny, right after it happened, my amazon staging server stopped working. Could this be related? :P
If the software in your staging server depended on certain information in your staging database, clearly it might fail when that info suddenly vanished.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.