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

Provide options for DB user/password #76

Closed
lucrus73 opened this issue Dec 28, 2017 · 4 comments
Closed

Provide options for DB user/password #76

lucrus73 opened this issue Dec 28, 2017 · 4 comments

Comments

@lucrus73
Copy link

lucrus73 commented Dec 28, 2017

I'm not sure if this is my fault, maybe I've simply failed at understanding the docs.

I need to export the database:

$ wp db export
mysqldump: Got error: 1044: "Access denied for user 'myuser'@'localhost' to database 'mydb'" when using LOCK TABLES

This is actually expected in my case, because I don't want to give the user that WP uses to connect to the database the LOCK TABLES privilege.

However I need the "wp db export" command to work when manually invoked from time to time.
I'm ok with manually specifying different username and password, using the "--<field>=<value>" syntax, but that fails too:

$ wp db export --user=root --password=mypass
mysqldump: Got error: 1045: "Access denied for user 'myuser'@'localhost' (using password: YES)" when trying to connect

which means wp cli handed only the "--password" option to mysqldump, but not the "--user" option. That's expected too, because the "--user" option is a global option that's used to specify the WordPress user, not the database user.

However I couldn't find any "--dbuser" or similar option: I'm not sure if that's by design or a missing feature, but I think it would make sense to have it in the latter case.

@schlessera
Copy link
Member

There seems to be a conflict between mysqldump parameters and global WP-CLI parameters, which I consider a bug.

I suggest we add a mapping from --dbuser=<user> and --dbpass=<password> parameters to mysqldump's --user=<user> and --password=<password> arguments.

@lucrus73
Copy link
Author

which I consider a bug

Should I file a bug report here then?

@schlessera
Copy link
Member

No, please do so in wp-cli/db-command.

@gitlost
Copy link

gitlost commented Dec 29, 2017

Closing this for wp-cli/db-command#74

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

No branches or pull requests

4 participants