0

I am trying to use wp-deploy (which makes use of Capistrano) to deploy my Wordpress site to a Digital Ocean Droplet. I think I have everything configured properly but when I try to run the ...

bundle exec cap staging db:pull

... I get an error

SSHKit::Runner::ExecuteError: Exception while executing as sudousername@xxx.xxx.xxx.xxx: wp exit status: 127 

(username and IP changed for privacy of course). So I SSH into my droplet and try to just connect to mysql using

mysql -u sudousername -p

and get the following error...

ERROR 1045 (28000): Access denied for user 'sudousername'@'localhost' (using password: YES)

I think this is because sudousername belongs to the sudo group and that group doesn't have permission to manage the DB?

I was hoping to find one of two solutions:

  1. Grant the appropriate permissions to sudousername so it can do what it needs to on the DB
  2. Pass along a second username and pass with Capistrano for the DB user (I created a user with phpmyadmin when I setup the database for Wordpress). The thought here being that when Capistrano is already SSH'd in and trying to perform functions on the DB it would use this other username and password.

I have looked for a solution for a couple hours now but I am a server n00b and haven't been able to find anything (and probably not sure what I am looking for).

Is anyone able to help? Thanks in advance!

5k313t0r
  • 51
  • 1
  • 1
  • 8
  • Mysql doesn't use system user accounts or permissions as such. It has its own built-in system of user accounts. [Here's how](http://stackoverflow.com/questions/10895163/how-to-find-out-the-mysql-root-password) to reset the mysql root password. – Juan Tomas Aug 12 '16 at 18:49
  • thanks for getting back to me @JuanTomas ! Thanks for pointing that out. Option 1 is probably off the table then. Do you know Capistrano or wp-deploy at all? Do you know if there might be something in my configuration that is incorrect then? – 5k313t0r Aug 12 '16 at 19:14
  • I can post any configuration settings is needed. – 5k313t0r Aug 12 '16 at 19:15

1 Answers1

0

I have figured out what the issue was. wp-deploy was using my sudo users credentials to SSH in and execute some shell commands. One of which was trying to use the WP Cli tool which I didn't have installed. Once I installed the WP Cli tool the scripts SSH'd in and ran wp db export and does so as the correct DB user. Thanks to @JuanTomas for helping me narrow that down.

For those that are having the same issue I also had to grant my DB user permissions for "LOCK TABLES'. Also, if you are using Wordpress 4.4+ you need WP Cli version 0.24 minimum or there will be compatibility issues. Use wp --info to check what version you have.

5k313t0r
  • 51
  • 1
  • 1
  • 8