Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PG::ConnectionBad: could not translate host name error after running export DATABASE_URL=postgres://$(whoami)

I received this error after running

export DATABASE_URL=postgres://$(whoami)

on the command line. Now when I run the command

$$ rake db:migrate

This is the full error

rake aborted!
PG::ConnectionBad: could not translate host name "Jillian" to address: nodename nor servname provided, or not known

Tasks: TOP => db:migrate

How can I fix postgres?

PS I was following this tutorial https://devcenter.heroku.com/articles/heroku-postgresql#local-setup to set up pg for a python app, but I may have an old version of pg. I'm trying to at least get postgres back to how it was before I ran that^

like image 451
Jillian Hoenig Avatar asked Aug 17 '16 19:08

Jillian Hoenig


1 Answers

....And the answer you've all been waiting for:

If you've messed up your development environment by running export DATABASE_URL=..., if you'e in a similar sitaution to the one above and already set up your environments within each project, resolve this issue by running

unset DATABASE_URL
like image 53
Jillian Hoenig Avatar answered Oct 14 '22 04:10

Jillian Hoenig