PHP connect to MySQL container created on Railway

PHP newbie here. I created a cloud MySQL provision using Railway (a Heroku alternative) which I’d like to connect to.

Connecting to the database should be fairly simple, as the service provides a connection url.
However, this fails to connect and throws: SQLSTATE[HY000] [2002] No such file or directory.

My attempt at connecting to the db instance:

<?php
try {
  $dsn        = "mysql://root:[email protected]:7265/railway";
  $username   = "root";
  $password   = "password";
  $options    = array(
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
  );

  $connection = new PDO($dsn, $username, $password, $options);
  echo "Database created successfully.";
} catch (PDOException $error) {
  echo $error;
  die();
}
?>

What am I missing?