welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

Remove definer from SQL Dump #301

Closed kLOsk closed 7 years ago

kLOsk commented 8 years ago

I just recently ran into a problem, that I had an existing database I wanted to sync with my local dev environment which database was still empty.

The remote db uses a wpxyxxsxysxy table prefix. I was able to pull in the db, but now when I want to push it to the also empty staging server I get an error:

mysqldump: Got error: 1449: The user specified as a definer ('pentalem_sg'@'localhost') does not exist when using LOCK TABLES

The missing user is only used on the production environment from where I originally pulled the dump from (surprisingly in my local dev environment it does not complain about the missing user).

I think it would be great if WordMove could remove the definers from dumps to avoid these kind of problems, or would this bear a security risk?

alessandro-fazzi commented 8 years ago

I have not enough knowledge on this topic, and I am very sorry to see anyone else had some clues about this problem... :(

hal0gen commented 8 years ago

Had the same issue as @kLOsk in a project. I use Bedrock and Wordmove and the problem for me was having different names for MySQL users on the local environment and on the server. My (hacky) fix to be able to pull from the remote db was to create a user on the server with the same name as the one on my local environment, and grant him all privileges. If this cannot be fixed easily, an idea could be to update the documentation (e.g. use identical usernames for local and remote databases).

alessandro-fazzi commented 8 years ago

@hal0gen here in weLaika we only use different mysql users on dev and production envs. On dev env we always use a plain root/nopwd setup, but obviously not on staging or production env...so...I can't imagine what else the problem could be, actually....

kLOsk commented 7 years ago

I found that one table was corrupt. dropping the corrupt table solved the issue.