New password won't work with iPhone?

Yahoo mail account got hacked 6/18. We changed Yahoo password via computer. Iphone5 asked for yahoo password. I typed in new password 4 times and the prompt kept reappearing. Now when I try to retrieve mail i get screen "Can't Get Mail the connection to the server failed." Are these events related? How do I restore connection? I'm afraid to test new password on computer in case we get locked out.

Try this

Remove the E-mail from your iPhone 5 completely.
then go ahead and put it again from start. And make sure its the correct password.
Double check in your computer that the password logs you in and then put the same password in your iPhone.