Skip to content

db import doesn't support --ssl flag #218

Open
@michaelryanmcneill

Description

@michaelryanmcneill

Bug Report

Summary

Running wp db import with the --ssl flag fails to properly connect to the database as expected.

How to reproduce

To reproduce, simply attempt to import with a user that requires SSL. For example:

$ wp db import --ssl database-2022-01-24-a50feb0.sql
Error: Failed to get current SQL modes. Reason: ERROR 1045 (28000): Access denied for user 'dbuser'@'127.0.0.1' (using password: YES)

But, if you run wp db cli --ssl, you can successfully connect to the database:

$ wp db cli --ssl
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 8.0.27 Source distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [database]>

Environment

OS:	Linux 5.11.0-1025-aws #27~20.04.1-Ubuntu SMP Fri Jan 7 13:09:56 UTC 2022 x86_64
Shell:	/bin/bash
PHP binary:	/RunCloud/Packages/php74rc/bin/php
PHP version:	7.4.26
php.ini used:	/etc/php74rc/php.ini
MySQL binary:	/usr/bin/mysql
MySQL version:	mysql  Ver 15.1 Distrib 10.5.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
SQL modes:
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/home/runcloud/webapps/example-com
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version:	2.5.0

Temporary workaround

To temporarily workaround this issue, use wp db cli --ssl and then source the file.

$ wp db cli --ssl
MySQL [database]> source database-2022-01-24-a50feb0.sql

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions