How to Remove Definer Clause from Dump File Before Migrating a MySQL Database
if you have sed (for windows go to http://gnuwin32.sourceforge.net/packages/sed.htm) available you can run
otherwise you can use on your preferred text editor as vim, notepad++ or emeditor (good for large files of several Terabytes) and do a search/replace.
search string:
replace string:
You can also remove the definer (empty string) instead of using your current user.
if you have sed (for windows go to http://gnuwin32.sourceforge.net/packages/sed.htm) available you can run
sed -E 's/DEFINER=`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' yoursqlfile.sql > outputsqlfile.sql
otherwise you can use on your preferred text editor as vim, notepad++ or emeditor (good for large files of several Terabytes) and do a search/replace.
search string:
DEFINER=`[^`]+`@`[^`]+`
replace string:
DEFINER=CURRENT_USER
You can also remove the definer (empty string) instead of using your current user.
Comments
Post a Comment