This can be caused by a problem with the hosts file.

- Make sure there is an entry for localhost

- Make sure there is no bad entry for the name of the database server you're
  trying to reach