PDOException: SQLSTATE[28000] [1045] Access denied for user '[username]'@'localhost' (using password: YES) in backup_migrate_destination_db->_get_db_connection() (line 216 of /sites/all/modules/backup_migrate/includes/destinations.db.inc).

This error won't allow me to either override the default profile, add another or enter the Advanced Backup sub-section. Not until I remove one of my destinations, which has a host address of 10.x.x.x. Localhost is somehow presumed in the code, but this is not an option for me. I'm trying to establish a staging env using VPN (a requirement of my client's IT).

Tried 2.2 and 2.x-dev. Tried to perform a clean module re-install. Tried various sequences of defining destinations vs overriding the default profile. All to no avail. Please advise.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ronan’s picture

Never seen this but I haven't tested specifically for it. I'll see if I can reproduce it. Thanks.

ronan’s picture

Status: Active » Closed (won't fix)

I can't reproduce this, and I don't think there's anything in my code that would replace your db server with localhost.

Please reopen if you're still having an issue and can give me some more info that might help me track this down.

ronan’s picture

I can't reproduce this, and I don't think there's anything in my code that would replace your db server with localhost.

Please reopen if you're still having an issue and can give me some more info that might help me track this down.

nonzero’s picture

I was able to reproduce this.

PDOException: SQLSTATE[42000] [1044] Access denied for user '[user]'@'localhost' to database '[database]' in backup_migrate_destination_db->_get_db_connection() (line 218 of sites/default/modules/backup_migrate/includes/destinations.db.inc).

([user] and [database] redacted) This happens when I have multiple databases with different users in the $database array in settings.php.

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
...
    ),
  ),
  'proposals' => 
  array (
    'default' => 
...
OliverColeman’s picture

Title: 'Localhost' presumed as host address? » Don't die when a connection can't be made to a secondary DB
Version: 7.x-2.x-dev » 7.x-2.8
Issue summary: View changes
Status: Closed (won't fix) » Needs review
FileSize
1.74 KB

Me too, when I have a secondary DB listed in settings.php to which a connection can't be made (for whatever reason), which I'm guessing is the problem for at least some of the above commenters.

The attached patch changes the behaviour by testing whether a connection can be made to a DB before including it in the list of possible destinations.

couturier’s picture

Version: 7.x-2.8 » 7.x-3.x-dev
Status: Needs review » Needs work
DamienMcKenna’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: backup_migrate-test_db_con-1446780-5.patch, failed testing. View results

BrankoC’s picture

Are databases as destinations still a thing in B&M? This issue suggests they aren't, even though a lot of the code for this is still in place.