How can I setup multiple database connections? Can anyone help me to setup connection with multiple databases connection in Drupal 8? I have database on the same server and I want to access it along with default Drupal 8 database.
This is done in the same way as in Drupal 7: You can add the database credentials in your settings.php file.
$databases['default']['default'] = array(
  'database' =&gt; 'drupal8',
  'username' =&gt; 'username',
  'password' =&gt; 'password',
  'prefix' =&gt; '',
  'host' =&gt; 'localhost',
  'port' =&gt; '3306',
  'namespace' =&gt; 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' =&gt; 'mysql',
);

$databases['external']['default'] = array(
  'database' =&gt; 'external',
  'username' =&gt; 'username',
  'password' =&gt; 'password',
  'prefix' =&gt; '',
  'host' =&gt; 'localhost',
  'port' =&gt; '3306',
  'namespace' =&gt; 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' =&gt; 'mysql',
);

You will now have two connection options, default and external. You can tell Drupal to use the external connection using \Drupal\Core\Database\Database::setActiveConnection('external') and switch back to the default one with \Drupal\Core\Database\Database::setActiveConnection() once you don't need anymore the external connection.