I am able to connect to the remote database and fetch the results when I am using core PHP-MySQL connection.

But Drupal 7 returns empty array when I am using the same remote database connection. The local database is working fine.

Below is my database connection in settings.php

$databases['default']['default'] = array (
      'driver' => 'mysql',
      'database' => 'test',
      'username' => 'test',
      'password' => 'test',
      'host' => '*****',
      'port' => '3316',
      'prefix' => '',

When I am accessing my site, it is just returning Arrayas output. Is it a problem with my database user permissions or should I make any changes in Drupal database settings with port?

1 Answer 1


I resolved it. The problem is not in the database connection. I cleared the cache table in the database and it started working fine.

Earlier, I set the option 'Cache pages for anonymous users'. May be because of this, it didn't give the output.

Thanks for your answer.

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.