How can I write to a MySQL database that is hosted on a Cloudflare tunnel?

I have a MySql database on xx.xxx. com and I want to write to the database xxx. com both are using Cloudflare Tunnels.

Here is the code (PHP) that i use to access the database:

        define('DB_HOST', 'xx.xxx. com');
        define('DB_DATABASE', 'AccountData');
        define('DB_USERNAME', 'myUsername');
        define('DB_PASSWORD', 'Password');

It returns a 524 No Reason Phrase

The code used to connect to the DB is failing to connect, how can I fix this?

I believe it has something to do with cloudflare tunnels but if not I can look for answers somewhere else