Closed dotker closed 5 years ago
@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?
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.
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.
@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.
@dotker Any further information to share, or can we close this issue?
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'.
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)?