Drupal are working fine and no issue connect to the database. Default sources are there, however, it always "Failed to connect to MySQL server." when we perform a backup with database.
Here is the part of the error log:
Warning: mysqli::__construct(): (HY000/9002): SSL connection is required. Please specify SSL options and retry. in BackupMigrate\Core\Source\MySQLiSource->_getConnection() (line 136 of /modules/contrib/backup_migrate/lib/backup_migrate_core/src/Source/MySQLiSource.php) #0 /core/includes/bootstrap.inc(582): _drupal_error_handler_real(2, 'mysqli::__const..
Database using Azure MySQL, and due to policy, it been enforced only SSL connection. Hence, suspecting module unable establish the Database connection due to not including SSL connection.
https://docs.microsoft.com/en-us/azure/mysql/howto-configure-ssl
Additional testing had been conducted which migrate database to without enforced SSL connection, and it is working fine.
Comment | File | Size | Author |
---|---|---|---|
#20 | backup_migrate-n3006542-20.patch | 3.24 KB | DamienMcKenna |
| |||
#17 | 3006542-17.patch | 3.33 KB | ashlewis |
#16 | 3006542-16.patch | 3.17 KB | ashlewis |
#14 | 3006542-14.patch | 2.74 KB | ashlewis |
#11 | 3006542-11.patch | 3 KB | ashlewis |
Comments
Comment #2
maki3000 CreditAttribution: maki3000 commentedI think you have to setup your "Sources" first before you can backup your database. Go to the configuration of the Backup and Migrate module, then to Settings and then to Sources (I guess this is the right naming. I'm not 100% sure because my Drupal is in German).
What I wonder however is, why the default sources aren't there anymore. In an older version of this module, the main backup sources were predefined in place, like default_db, entire_site, private_files and public_files. What do I have to do that these default sources are there again?
Comment #3
cl.choong CreditAttribution: cl.choong commentedComment #4
cl.choong CreditAttribution: cl.choong commentedComment #5
TedWS CreditAttribution: TedWS commentedI also experiencing the same issue backup and migrate with SSL.
@maki3000
I tried setup the configuration in "Sources", but i get the error as below:
Warning: mysqli::__construct(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in BackupMigrate\Core\Source\MySQLiSource->_getConnection()
I also tried using the ipaddress instead of the domain name, but i still get the same error.
Comment #6
Alex Andrascu CreditAttribution: Alex Andrascu at Intellix commentedOk. That's a good point. Let's look into getting those default sources back in.
Comment #7
jacklee0410 CreditAttribution: jacklee0410 commentedHi, I have face the same problem as well.
I have found something below.
but i'm not sure how to fit this code into the backup and migrate module.
Can anyone help?
Comment #8
jacklee0410 CreditAttribution: jacklee0410 commentedHi, I have found a solution for ssl method. however it is a hardcode currently. After modified this code below in "backup_migrate/lib/backup_migrate_core/src/Source/MySQLiSource.php" it should work with ssl connection.
Comment #9
ashlewis CreditAttribution: ashlewis at S8080 commentedHere's a patch to use the PDO SSL config from settings.php if present, e.g.
Comment #10
ashlewis CreditAttribution: ashlewis at S8080 commentedSorry, the first patch was using SSL connection even when not configured - updated patch attached.
Comment #11
ashlewis CreditAttribution: ashlewis at S8080 commentedand here's another one that composer is able to apply
Comment #12
DamienMcKenna@ashlewis: That's a great idea, thanks.
Could you please update the patch to just store $this->confGet('pdo') in an array? That'd greatly simplify the rest of the code.
Comment #13
ashlewis CreditAttribution: ashlewis at S8080 commentedAgreed it looks a bit messy. However, $this->confGet('pdo') returns a populated array even when ssl values are not set in settings.php and i don't know enough about this to know which of the pdo config parameters may or may not be populated in settings.php, i used what drush does (https://github.com/drush-ops/drush/pull/2131/commits/3d4fab4051d22e9fbea...) as example.
Comment #14
ashlewis CreditAttribution: ashlewis at S8080 commentedHere you go, managed to tidy it up a bit.
Comment #15
DamienMcKennaThat's awesome, thank you!
Lets see what the testbot says.
Comment #16
ashlewis CreditAttribution: ashlewis at S8080 commentedHere's another patch which provides a workaround for PHP7's peer certificate verification issues (see: https://bugs.php.net/bug.php?id=68344 and https://bugs.php.net/bug.php?id=71003)
Comment #17
ashlewis CreditAttribution: ashlewis at S8080 commentedAnd another one that doesn't break on older versions of php where PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT hasn't been introduced
Comment #18
jacklee0410 CreditAttribution: jacklee0410 commented#17 patches it works. Thanks @ashlewis
Comment #19
DamienMcKennaPresuming the tests still work fine, this should be good to go. Thank you.
Comment #20
DamienMcKennaRerolled.
Comment #22
DamienMcKennaCommitted. Thank you.