welaika / wordmove

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

mysqldump: Got error: 1045: Access denied for user #191

Closed colin-marshall closed 9 years ago

colin-marshall commented 9 years ago

Hi, I get this error when trying to pull my database: mysqldump: Got error: 1045: Access denied for user 'username'@'173.248.188.247' (using password: YES) when trying to connect

I can transfer files just fine using wordmove, it appears the database pushing and pulling is the only thing not working.

I can login to my database just fine using the exact same credentials in Sequel Pro. My webhost requires that I add access hosts for databases. Right now I just have my external IP as an access host. Is it possible that it is denying me access because the remote mysql sees a different IP when I access it through Vagrant using vvv?

Here is the output (passwords removed):

vagrant@vvv:/vagrant/www/djcoma/htdocs$ wordmove pull -d -e production

▬▬ ✓ Using Movefile: ./Movefile ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ ✓ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    local | mysqldump --host=localhost --user=wp --password=wp username > /vagrant/www/site/htdocs/wp-content/local-backup-1437070970.sql
   remote | mysqldump --host=productionserver.com --user=username --password=password db_name > /home/user/public_html/wp-content/dump.sql
/usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/deployer/ssh.rb:55:in `remote_run': Error code 2 returned by command "mysqldump --host=production.com --user=username --password=password db_name > /home/djcoma/public_html/wp-content/dump.sql": stdin: is not a tty (RuntimeError)
mysqldump: Got error: 1045: Access denied for user 'username'@'host_ip' (using password: YES) when trying to connect
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/deployer/ssh.rb:62:in `download_remote_db'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/deployer/ssh.rb:34:in `pull_db'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:47:in `block in pull'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:34:in `block in handle_options'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `each'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `handle_options'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:46:in `pull'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /usr/local/rvm/gems/ruby-2.2.1/gems/wordmove-1.2.0/bin/wordmove:6:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/wordmove:23:in `load'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/wordmove:23:in `<main>'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
colin-marshall commented 9 years ago

Figured it out. I guess since it was sending the mysqldump command after SSH'ing to the server, I had to add the IP of the server to the allowed hosts.

ghost commented 7 years ago

Hi Colin, I have this exact issue, but I don't quite understand what you did to fix it — could you give me a hint? (Adding the IP of the server to the allowed hosts).

colin-marshall commented 7 years ago

@toeatsteakrare in my case I had to login to my cPanel, go to the Remote MySQL page, and add the IP address of the host server to the allowed hosts. I think this essentially gives the server permission to access itself.