TransWikia.com

Can't connect to remote DigitalOcean database

Drupal Answers Asked by ymdahi on December 18, 2020

I am attempting to connect an existing Drupal 8 site to a DigitalOcean managed Database.

The connection info I’ve received from DigitalOcean:

username = digitaloceanadmin
password = password
host = nameofmydbcluster.db.ondigitalocean.com
port = 25060
sslmode = REQUIRED

I’ve made the adjustments to settings.php:

$databases['default']['default'] = array (
  'database' => 'dbname',
  'username' => '...',
  'password' => '...',
  'prefix' => '',
  'host' => 'dbclustername.db.ondigitalocean.com',
  'port' => '25060',
  'namespace' => 'Drupal\Core\Database\Driver\mysql',
  'driver' => 'mysql',
);

However, I’m getting the following error:

PDOException: SQLSTATE[HY000] [2054] The server requested authentication method 
unknown to the client in ...

More errors when I drush cr:

In Connection.php line 416:

  SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client


In Connection.php line 416:

  PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

I am running Drupal 8.8.1 with php7.2. The DB version on remote is MySQL 8.

Any help would be greatly appreciated.

One Answer

I was able to resolve this from the info found here:

https://skoop.dev/blog/2019/10/04/PHP-and-the-DigitalOcean-MySQL-cluster/

The problem stemmed from the default authentication method for MySQL v8 is caching_sha2_password, which the article above suggests is not supported by php yet.

As the article suggests, we can switch back to the old authentication method with the following query:

ALTER USER 'myuser'@'%' IDENTIFIED WITH mysql_native_password BY 'thepasswordyouwant';

After making this alteration to the dbuser, I was able to connect to the digitalocean database without issue.

Answered by ymdahi on December 18, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP