wordmove: --db push/pull not working: Problems with mysqldump
I left a couple of comments on an old and closed issue, but perhaps better to open a fresh one to get to the root of this. It seems many people have been struggling with this one.
I could never get the db to push or pull (everything else worked great) and so just resolved to use WP Migrate DB plugin. However, that code has now forked in a few repos and I cannot get any of them to work anymore, hence needing this to work as the only alternative to using a less than ideal plugin or manually search/replacing urls in the db.
I have narrowed the problem down to Bash not knowing where mysqldump is installed. Even though I am using Zsh, the original error I was getting was:
sh: mysqldump: command not found
Following on from my previous comments on the above referenced issue, I am not using vagrant, just AMPPS and Flywheel on OSX.
I am guessing that the wrong mysqldump is being referenced, since I went ahead and installed the mysql pkg installer (which was missing for some reason) that is now located at /usr/local/mysql/bin/mysql
It seems I need to tell bash (referenced from zsh) to use /Applications/AMPPS/mysql/bin/mysqldump
I have tried this in my .bash_profile: ssh-add -A 2>/dev/null;
export PATH=“/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin/mysql:/usr/local/mysql/bin/mysqldump:/Applications/AMPPS/mysql/bin/mysqldump:$PATH”
if which rbenv > /dev/null; then eval “$(rbenv init -)”; fi export PATH=/usr/local/bin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin
So locate mysqldump now at least gives:
/Applications/AMPPS/mysql/bin/mysqldump /Applications/AMPPS/mysql/bin/mysqldumpslow /Applications/AMPPS/mysql/man/man1/mysqldump.1 /Applications/AMPPS/mysql/man/man1/mysqldumpslow.1
Although which mysqldump gives:
/usr/local/bin/mysqldump
which mysql gives mysql not found (when unalias mysql is uncommented in .zshrc.
Otherwise it gives mysql: aliased to nocorrect mysql. And of course every change requires a restart of iTerm!!
I found a related issue here and also posted on SO
There is also a ticket on flywheel regarding the same issue.
Now the error when attempting to pull a remote db is:
mysqldump: Got error: 1045: Access denied for user 'xxxxx (using password: YES) when trying to connect
Regarding this error, I had also replied to this ticket a couple of years ago (apologies for not replying to the last comment), where it seems the error may be related to the live server and not my local?
Any ideas how this should be done?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 37 (20 by maintainers)
Ok, let me have a look through all that’s been written and see what can be condensed into notes for the wiki. This is the spirit of Open Source I guess 😃
The fact I am using AMPPS for MySQL, Local (newer version) for websites and Zsh for Terminal should offer some useful information for edge cases! I can also post over on the Local forum that I managed to get this working, and also I think there a lot of people who were relying on Migrate DB until it was forked and each fork eventually abandoned. Probably linking to here would help someone too.
It’s such a vital part of WordPress workflow to be able to do all this stuff quickly so I bet many more people would benefit from knowing about Wordmove.
Thanks again for being so patient and helpful with all this!
This is how I’ll have my launch time today
I actually have a suggestion about how you could send a tip: what about re-doing all these things from the beginning, briefly documenting the steps in markdown and add those notes on our wiki under the “Knowledge base” paragraph? Eventually that content could be delivered also to the “Local by Flywheel” community, if any (any?).
This would be a sponsorship for Wordmove and a help for Local’s users.
Hey, I know that it would be more expensive than a beer in terms of time! Just an idea you’re obviously free to ignore!
But thirst thing first: hooray @frontenddevguy ! You got a big journey on this one! 😄 I really hope you’ll get the deserved value in your work 😃
Okay!!!
Final hurdle was that I chose a site with different table prefixes…
I feel like there should be some kind of orchestral music for this magical moment 😃)
Please let me know how I can send you a tip for a well-earned beer
Hey Yan,
if you’d look back at my https://github.com/welaika/wordmove/issues/552#issuecomment-564129312 you’ll notice that in my snippet the space in the path was escaped like
Application\ SupportYou’re writing options for a command line and spaces must be escaped.
Wordmove does a lot of escaping here and there, for security reasons, or because it is masking where and how your configurations will be used; but I’m perfectly ok with wordmove not escaping spaces there, because we’re are directly writing command line options and we have to be aware of this.
That said: escape the space like I’ve done and that error will go away 😉