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

WP DB won't work if db connection is secured #126

Closed
dotker opened this issue Dec 5, 2018 · 6 comments
Closed

WP DB won't work if db connection is secured #126

dotker opened this issue Dec 5, 2018 · 6 comments

Comments

@dotker
Copy link

dotker commented Dec 5, 2018

Hello guys and gals! Anyone got wp-cli to work with secured database connections? Seems not working and seems people are rarely using a secured database connections(for remote databases)?

@schlessera
Copy link
Member

@dotker WP-CLI just uses the configuration that is set in your wp-config.php file.

What are you actually trying to do that fails, and what error does it produce?

@dotker
Copy link
Author

dotker commented Dec 7, 2018

If the flag: define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL); is on. Getting mysqldump: Got error: 1045: "Access denied for user ... So it doesn't work with secure database connection.

If a wp plugin does a backup with SSL connection to a remote database it works fine but wp-cli doesn't.

@dotker
Copy link
Author

dotker commented Dec 7, 2018

Also just like to add that the database user has REQUIRE SSL with it so it can only accept secured connections. And thanks for looking and/or assistance on this issue.

@schlessera schlessera transferred this issue from wp-cli/wp-cli Dec 12, 2018
@schlessera
Copy link
Member

@dotker As you're referencing mysqldump, I assume you are trying to use the wp db export command.

The MYSQLI_CLIENT_SSL flag is specific to the PHP mysqli extension. The mysqldump binary is not PHP code, so the flag does nothing in this case.

Did you try adding the --ssl flag to the command? This would forward the --ssl flag to the mysqldump binary.

@danielbachhuber
Copy link
Member

@dotker Any further information to share, or can we close this issue?

@mikebridge
Copy link

I think the --ssl flag is missing from wp help db export. @schlessera 's suggestion works for me:

$ wp db export --path=/var/www/html
mysqldump: Got error: 9002: "SSL connection is required. Please specify SSL options and retry." when trying to connect
$ wp db export --ssl --path=/var/www/html
Success: Exported to 'wordpress-2020-09-15-ab86af3.sql'.

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