Created
December 25, 2013 09:38
-
-
Save anytizer/8121760 to your computer and use it in GitHub Desktop.
Hassle free database dump: Trick is to remove the DEFINER.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HOSTNAME=localhost | |
USERNAME=username | |
PASSWORD=password | |
DATABASE=database | |
cd /tmp | |
mysqldump --routines -h${HOSTNAME} -u${USERNAME} -p${PASSWORD} ${DATABASE} > ${DATABASE}.dmp | |
sed -E 's/DEFINER=`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' ${DATABASE}.dmp > ${DATABASE}-clean.dmp | |
rm -f ${DATABASE}-clean.dmp.gz | |
gzip -9 ${DATABASE}-clean.dmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment