View API connection to external DB 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 @127.0.0.1), 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' =&gt; 'propertychannel',
  'username' =&gt; 'drupal_viewer',
  'password' =&gt; 'xxxxxx',
  'host' =&gt; 'pc-live-main-db.xxxxxxxxx.eu-west-1.rds.amazonaws.com',
  'port' =&gt; '3306',
  'unix_socket' =&gt; '/opt/bitnami/mysql/tmp/mysql.sock',
  'driver' =&gt; 'mysql',
  'prefix' =&gt; '',


);

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?]
Eventually figured it out! (obvious in hindsight!)

I shouldn't have had the line:

'unix_socket' =&gt; '/opt/bitnami/mysql/tmp/mysql.sock',


in the database setting in settings.php

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