Connecting to a remote database in D8
You can use like:

$other_database = array(
  'database' =&gt; 'drupal8',
  'username' =&gt; 'root', // assuming this is necessary
  'password' =&gt; '123123', // assuming this is necessary
  'host' =&gt; '192.168.1.243', // assumes localhost
  'port' =&gt; '3306',
  'namespace' =&gt; 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' =&gt; 'mysql', // replace with your database driver
);
// replace 'YourDatabaseKey' with something that's unique to your module
Database::addConnectionInfo('d8243', 'default', $other_database);
db_set_active('d8243');
// execute queries here
db_set_active()


You can access your other database like above. For reference check this link.