I had this same exact problem ... heres what I did to fix it...
Code:
<database>
<host>127.0.0.1</host>
<port>3306</port>
use 127.0.0.1 instead of "localhost" ... yes I know its the same thing.. but my build kept failing to connect without this change