A remote DB on a remote server involves networking. In order to assist you will have to provide some more info in the setup of your moodle ... especially the remote DB server.
If you can, suggest installation of MySQLTuner ... assuming the DB is MySQL or MariaDB ... on the web server and run it with superuser credentials of the DB server.
'SoS', Ken
No offense, but screen shots from a mobile device leaves a lot to be desired. :| Example .... blue on black background ... can't read! Tuner does have an option for running with 'no color'.
There was a lot more in that output than just the recommendations ... yes, you need to sort out what to share/obscure ... anything that has [!!] is, according to Tuner, not good/optimal and there will probably be recommendation related.
This sort of thing can be ticky and is unique to your hosting/networking, etc.
It will also should require you to set up host and users coming from the IP address your web server to be the only ones allowed to access specific databases ... don't want the globe to be able to poke and probe the DB box for DB server.
Please see:
https://dev.mysql.com/doc/refman/8.0/en/ipv6-remote-connections.html
and choose your version of MySQL and networking ... above shows vr 8 and IPv6 ... You might need version 5.7 and IPv4.
'SoS', Ken