In config.php, what do you have for DB server?
If 'localhost' that means DB server is on the same server as moodle code ... which to the DB server is a client.
Have you setup any workstation with the ability to directly access the DB server?
https://dev.mysql.com/doc/refman/8.0/en/server-options.html#option_mysqld_skip-name-resolve
https://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_skip-name-resolve
'spirit of sharing', Ken