I had the same problem on a new WordPress installation (yesterday) on a new MacMini using SQL 8.0 on MacOS 11.1, and on an old MacMini using SQL 5.7 on MacOS 10.13.
Thanks to luckybaky for the non-obvious solution.
Except I used :3306 (the standard MySQL port), and then found that the port doesn’t matter. Also, a DNS name that resolves to 127.0.0.1 also works. (“mouse-potato.com”, for example).
“With all due respect, you have done *something* wrong, since it is not working.”
Someone, somewhere, ain’t handling “localhost” correctly or consistently, and if all of us did something wrong, the error messages were of no help in fixing the problem in a way that is not documented anywhere I could find.