Programming
Fixing MySQL: Connects via localhost but Not via 127.0.0.1
I ran into this problem while deploying a project at a client's environment. The project's MySQL connection string was localhost, but it errored out saying the database couldn't be connected, and the connection string had been replaced with 127.0.0.1. At first I thought it was a network connectivity issue, so I ran mysql -u root -p and found I could connect fine; ping localhost also resolved to 127.0.0.1. I suspected a mismatched MySQL JDBC driver and swapped countless driver jars, but I was sure it wasn't my program, so I started Googling and found many people with the same situation. I'm summarizing it here for reference. The type of problem I hit was a permissions issue.
ProgrammingDevelopmentDatabaseMySQL