title: Why does Phoenix (ecto/Postgresx) fail to Connect in dev
body: <p>I am beginning my Elixir/Phoenix journey and having some trouble with my postgres connection.</p>
  
  <p>When I start up my server I get:</p>
  
  <pre><code> $ mix phoenix.server
   [error] Postgrex.Protocol (#PID&lt;0.214.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.217.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.218.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.211.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.215.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.219.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.216.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.213.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.212.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [error] Postgrex.Protocol (#PID&lt;0.210.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
   [info] Running Rumbl.Endpoint with Cowboy using http://localhost:4000
   [error] Postgrex.Protocol (#PID&lt;0.215.0&gt;) failed to connect: ** (Postgrex.Error) tcp connect: connection refused - :econnrefused
  </code></pre>
  
  <p>Being new to Elixir, Phoenix, and Ecto I am unclear how to debug this problem. Any suggestions as to what my problem is or how I might go about debugging it would be much appreciated.</p>
  
  <p><strong>My app's set up</strong></p>
  
  <p>I have a basic app</p>
  
  <pre><code>mix phoenix.new rumbl
  cd rumbl
  mix deps.get
  mix deps.compile
  </code></pre>
  
  <p>My config/dev.exs has the following db setup</p>
  
  <pre><code># Configure your database
  config :rumbl, Rumbl.Repo,
    adapter: Ecto.Adapters.Postgres,
    username: "elixir",
    database: "rumbl_dev",
    hostname: "localhost",
    pool_size: 10
  </code></pre>
  
  <p>When I run <code>mix ecto.create</code> there are no errors and I can see the <code>rumbl_dev</code> when I run <code>\l</code> in psql. It is owned by the elixir user too.</p>
  
  <p>Running <code>mix ecto.migrate</code> throws the same connections errors</p>
  
  <p>My pg_hba.conf file has the following</p>
  
  <pre><code>local   all             all                                     trust
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            trust
  # IPv6 local connections:
  host    all             all             ::1/128                 trust
  </code></pre>
  
  <p>Here is what I see when I log in with psql</p>
  
  <pre><code>$ psql --dbname=rumbl_dev --username=elixir --host=127.0.0.1 --password
  Password for user elixir:
  psql (9.4.5)
  Type "help" for help.
  
  rumbl_dev=&gt;
  </code></pre>