Remote Connection to database refused when using modules

Situation
i am installing emr 7.0 on linux server and i am facing the following

i am using mobule, and i am using a remote database connection

when trying to open modules page, it is giving for me

Exception: Connect Error: SQLSTATE[HY000] [2002] Connection refused
Exception: SQLSTATE[HY000] [2002] Connection refused

BUT When i tried to connect to a database on the same local server, i got connected

i need to connect remotely because the policy of my company is not to have the databse existing on same server

can anyone help me to do it, or tell me the pre requisite to connect remotely

OpenEMR Version
7.0

Browser:
chrome

Operating System
server: linux
laptop: windows

Search
Did you search the forum for similar questions?
yes

Logs
Did you check the logs?
i am getting this:
ERROR :
Exception: Connect Error: SQLSTATE[HY000] [2002] Connection refused
Exception: SQLSTATE[HY000] [2002] Connection refused
SQL statement : SELECT * FROM modules ORDER BY mod_ui_order ASC

Was there anything pertinent in them?
Please paste them here (surround with three backticks (```) for readability.
You can also turn on User Debugging under Administration->Globals->Logging User Debugging Options=>All

Note
php version 8.2
mysql version 8

The first think I’d check is if you have your database to allow remote connections. Here is a link to get you started in that direction.

the remote connection is working, when i made a separate file (testremoteconnetion.php), i am able to connect through it

but through modules i am having this issue

notice that i already followed those steps before

php version 8.2
mysql version 8

can you please advice