ActiveRecord::Base.connection.tables.each do |table_name|ActiveRecord::Base.connection.execute("select * from #{table_name} into outfile '/tmp/datadump-#{table_name}.outfile'")end
(or see this gist)
That creates a series of tab-separated files in /tmp/. Then LOAD DATA INFILE queries can bring the data back in, or in my case I used Sequel Pro’s import command configured for tab-separated input.