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

Not able to pull database using acquia acli #3580

Open
rusapkar-cci opened this issue Jun 9, 2023 · 2 comments
Open

Not able to pull database using acquia acli #3580

rusapkar-cci opened this issue Jun 9, 2023 · 2 comments

Comments

@rusapkar-cci
Copy link

unable to connect local database using credentials mysql:://drupal:drupal@localhost, It was working yesterday. Not sure why it takes user and password as drupal.
MicrosoftTeams-image (15)

@Sen-Bounteous
Copy link

Sen-Bounteous commented Jun 25, 2023

Had the exact same issue

Here's how I solved it,
Problem
I think the default username, password and db-name for connecting to the database has changed somehow. So when pulling from acquia, it was not able to connect to the database

Solution
Get the correct info from lando and update it in .lando.yml. Since the new database doesn't exists, we have to manually create it

Steps
I ran this command to get the info

lando info

Got back (username, password, db-name might be different for you)
creds: { database: <db-name>, password: <password>, user: <username> }

Then, get into DB docker container and create the database

lando mysql
create database <db-name>

In .lando.yml, add the credentials

services:
  database:
    portforward: true
    creds:
      user: '<username>'
      password: '<password>'
      database: '<db-name>'

once the configuration is updated, destroy lando and start it again. when db creds are changed, we have to do lando destroy and start it as mentioned here

lando destroy -y && lando start

@maskedjellybean
Copy link

I ran into this because I had overridden the database creds in .lando.yml to something other than "acquia". Apparently the only way lando pull works with the Acquia recipe is if the database creds in .lando.yml are:

services:
  database:
    creds:
      user: acquia
      password: acquia
      database: acquia

Also in your Drupal settings.php or settings.local.php:

/**
 * When using Lando, use Lando settings.
 * Prepare a LANDO_INFO constant.
 * See: https://jigarius.com/blog/drupal-with-lando
 */
$info = getenv('LANDO_INFO');
if ($info) {
  define('LANDO_INFO', json_decode($info, TRUE));
}

// Configure database for Lando.
if (defined('LANDO_INFO')) {
  if (!isset($databases))
    $databases = array();

  $databases['default']['default'] = [
    'driver' => 'mysql',
    'database' => LANDO_INFO['database']['creds']['database'],
    'username' => LANDO_INFO['database']['creds']['user'],
    'password' => LANDO_INFO['database']['creds']['password'],
    'host' => LANDO_INFO['database']['internal_connection']['host'],
    'port' => LANDO_INFO['database']['internal_connection']['port'],
    'prefix' => '',
  ];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants