Actually, zenphoto will not tell you why it cannot connect since that information is not available at all. (Mostly for security reasons!!!) Cannot connect to the database means that one of the items about your database is not correct.
If you have checkec and rechecked the database, user, and password the only thing left is micheall's suggestion of database host.
If you have checked, rechecked, and checked again everything, then you are decieved about one of those items.