As I had the occasion to take an existing database and make some wholesale changes to it and reload it under a new name, and particularly wanted to do this possibly numerous times while I tweaked the changes I'm making, the thought had crossed my mind to use sed or something similar to take a database dump, modify a few of its particulars, and load it under a new name. With that in mind I created a bash script rather like the following:
#!/bin/bash[Read more]
mysqldump -h server -u root -ppassword \
--database olddatabasename \
--routines \
--ignore-table=olddatabasename.page_content \
--add-drop-database \
--add-drop-table \
\
| sed -e "s/\`//g" \
-e "s/olddatabasename/newdatabasename/g" \
-e "s/Song/Work/g" \
-e "s/song/work/g" \
-e "s/artists_works/artist2work/g" \
\
| mysql -h server -u root -ppassword
mysql …