Prerender PDO connection - Unable to connect (Docker & PHP)

Would someone please be able to help?

I’m trying to make a prerender connection to the Docker DB so that some basic values are rendered on the server (SEO meta tags, favicon, FB/Twitter cards etc.) before the page is loaded. I have added code to create a PDO connection but get the following error:
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

Having done a bit of looking, it seems setting up a ‘Standard’ authentication method user on the DB should solve this but it appears not. Is there something in the way the DB is set up for Docker that needs to be adjusted for?

I have checked and the ‘preload’ user has a standard password set (not caching_sha2_password)

<?php
$dom = $_SERVER['HTTP_HOST'];
    $host = "xxx.co.uk"; // db URL set up in the target
    $dbname = "xxtes";
    $cesuser = "preload";
    $cespw = "xxx";
    $core = $_GET['pagename'];
    $sub = $_GET['subpage'];

    try {
        $connpl = new PDO("mysql:host=$host;port=9906;dbname=$dbname", $username, $password);
        $connpl->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        
        //The SQL statements
        $stmtpl = $connpl->prepare("SELECT * FROM preloaddata WHERE domainname = '$dom' AND coreroute = '$core' AND childroute = '$sub'");
        
        $stmtpl->execute();
        $preload = $stmtpl->fetch();
        mysql_close($connpl);
        
    }
    catch(PDOException $e) {
        echo "Connection failed: " . $e->getMessage();
    }
?>