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.

Amazon recommends using mysqldump only for "small amounts of data", which they define as less than 1GB. The database I intend to migrate is over 20GB.

One thing that's nice about mysqldump, however, is that it has the --single-transaction flag, which allows me to ensure a DB state that is consistent with a single point in time.

For larger amounts of data, Amazon's recommendation is to export the database into flat (e.g., CSV) files and then use mysqlimport to import those to RDS. The best way I know how to do this, however, is through the SELECT ... INTO OUTFILE command, which only operates one table at a time. The downside to this, of course, is that it doesn't provide the consistency guarantee of --single-transaction.

I suppose I could ensure consistency by taking the entire DB down temporarily; but I'd like to avoid that if at all possible.

What's the best way to get my large (> 20GB) database into flat files so that I can then use mysqlimport?

If it is indeed the SELECT ... INTO OUTFILE command, how do I export all of the tables in the database (preferably without having to do one at a time)?

This question came from our site for professional and enthusiast programmers.

1

This is probably a better fit for ServerFault; voted to migrate
–
SimpleCoderSep 12 '12 at 21:14

1

Have you tried it - just wondering? I just dealt with a 40G database using mysqldump the other day -- just takes some time. But --opt is default, which speeds things up. I think we took 6 hours to reload onto a potent server, but transitions are transitions... :)
–
gahooaSep 12 '12 at 21:26

@gahooa: Good question. I haven't tried it yet, mainly because it seemed from the Amazon documentation that it wasn't recommended. But I may just go ahead and do that.
–
Dan TaoSep 12 '12 at 22:04

1 Answer
1

I just recently spent a lot of time trying to figure out a 15GB transition to RDS. Ended up finding a script on one of the amazon forums that I modified to my own uses and seems to work well. I'm not sure if you can do single transaction, but the dump itself is very quick compared to the actual transfer. I think 15GB only took me 12 minutes to dump, so even if it doesn't have single transaction option I don't think you'd have a very long span of time for inconsistencies to occur. I'm not sure if that's good enough for you, but I found the solution a lot more graceful than the flat file method.