I also got the same error. After trying a ton of different solutions, I changed the host from localhost to the IP 127.0.0.1, and it worked perfectly.
localhost
127.0.0.1