Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DEFINER statements from db dumps #130

Closed
fbrnc opened this issue May 1, 2013 · 9 comments
Closed

Remove DEFINER statements from db dumps #130

fbrnc opened this issue May 1, 2013 · 9 comments

Comments

@fbrnc
Copy link
Contributor

fbrnc commented May 1, 2013

Magento EE 1.13 (and 1.8) are using mysql triggers. When creating database dumps MySQLwill include a "DEFINER" statement with the current username and hosts. Importing this on another server won't work.

I'm not sure if there is a cleaner way to do this, but removing the DEFINER statement works fine for me.

cat dump.sql | sed -e 's//[^_]DEFINER=[^_]///'

If this is the way to go the db:dump command could take care of doing this.

@cmuench
Copy link
Member

cmuench commented May 1, 2013

Only Magento EE 1.13 uses triggers. It's for the new Indexing which will not be included in CE 1.8.

@cmuench
Copy link
Member

cmuench commented May 1, 2013

I will check your recommendation in a EE 1.13.

@cmuench
Copy link
Member

cmuench commented May 3, 2013

Confirmed. I added a first version with sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/'.

Solution found at: http://stackoverflow.com/questions/9446783/remove-definer-clause-from-mysql-dumps

@fbrnc Nearly the same as your version.

Committed in develop branch.

@cmuench
Copy link
Member

cmuench commented May 3, 2013

Feature was deployed with latest release.

@cmuench cmuench closed this as completed May 19, 2013
steverobbins pushed a commit to steverobbins/n98-magerun that referenced this issue Apr 7, 2015
@convenient
Copy link
Contributor

Just putting this here, I received the following error:

sed: RE error: illegal byte sequence
mysqldump: Got errno 32 on write

I had to run the following before triggering the mysqldump to get this to work correctly.

export LANG=C

A very useful feature, thanks

@tkn98
Copy link
Collaborator

tkn98 commented Feb 11, 2016

hmm, sed is getting picky, nice. @convenient: Can you create a new ticket for this? Just reference to here so that it's clear when it was introduced.

@convenient
Copy link
Contributor

@tkn98 Now that I look at it with fresh eyes it's clearly OSX being weird.

Original definition of $LANG is as follows

echo $LANG
en_GB.UTF-8

@tkn98
Copy link
Collaborator

tkn98 commented Feb 12, 2016

@convenient: well, depends. if sed internally changes from default C locale for string operations to the one in the environment variable, then this is the issue. It's possible to have C strings but they are not valid UTF-8, e.g. other 8 bit ISO encodings in a dump file. I think your suggestion to export LANG=C is reasonable for the intended operation.

@convenient
Copy link
Contributor

Fair enough i'll open up another issue shortly. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants