We are having problems when we need to work on recovering some lost data (improper use of maatkit when setting up Master-to-master replication), and I'm trying to import an old database dump. The problem is that at the top of the file it explicitly indicates the database (mysqldump was started with the -all-databases option), and I need to change this database to something else so that I can find another there, next to it, for comparison. The line reads:
CREATE DATABASE `dms`
I could not open the file in vi for editing due to the large dump size, and it is a bit hesitant to use sed because of how it will read line by line for any pattern matching. The easiest and most efficient way to change the above line in a sql dump:
CREATE DATABASE `dms_old`
Or just use some mysql black magic to import it into the dms_old database?
Scott source share