I've a Drupal 7 site setup on an AWS server, and I'm trying to access a mysql db on a AWS RDS.(The Drupal db is located on the Drupal server, the table I'm trying to get is just to access some external data).

When I try to use the Views API I get the following error:

PDOException: SQLSTATE[HY000] [1045] Access denied for user 'drupal_viewer'@'localhost' (using password: YES) in views_plugin_query_default->query() (line 1293 of /opt/bitnami/apps/drupal/htdocs/sites/all/modules/views/plugins/views_plugin_query_default.inc).

I've setup the mysql user "drupal_viewer" with the correct permissions, and to verify that I've created a short php page in the root folder of the Drupal server. When I run that, it runs fine and connects and executes a test query. So that verifies that the security groups etc are fine and that my Drupal server can "see" the RDS instance.

I've tried various combinations of the user on the mysql setup (@%, @localhost and @, but the views API keeps trying 'drupal_viewer'@'localhost' which is failing.

I have the db info setup correct in my settings.php (and have done Clear Cache etc).

$databases['pc_propertychannel']['default'] = array (
  'database' => 'propertychannel',
  'username' => 'drupal_viewer',
  'password' => 'xxxxxx',
  'host' => 'pc-live-main-db.xxxxxxxxx.eu-west-1.rds.amazonaws.com',
  'port' => '3306',
  'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',
  'driver' => 'mysql',
  'prefix' => '',


What am I forgetting?

[Edited to Add: as a debug, I tried connecting via mysql console from the Drupal server to my RDS instance, using the above credentials, and it works fine. So I'm thinking this may be a Drupal config/issue?]

1 Answer 1


Eventually figured it out! (obvious in hindsight!)

I shouldn't have had the line:

'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',

in the database setting in settings.php

Removed it for the remote db's and it works perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.