Can't find MySQL server on WordPress install with sockets
Checking out other Stackexchange answers, looks like something along these lines should work

You can set the DSN in the civicrm.settings.php file using this format:

mysqli://user:password@unix(/path/to/socket)/databasename

Use the actual word "unix" in the string to indicate sockets.

For Reference this is the previous answer