title: Getting bad connection error when trying to migrate in rails.
body: <p>I want to create a rails api and wanting to migrate the database.  I have started postgresql with the following command <code>brew services restart postgresql</code>. The console gave me the following response <code>==&gt; Successfully started `postgresql` (label: homebrew.mxcl.postgresql)</code>.  The problem is when I run rails db:migrate I get the following error </p>
  
  <pre><code>rails db:migraterails aborted!
  PG::ConnectionBad: could not connect to server: No such file or directory
      Is the server running locally and accepting
      connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
  </code></pre>
  
  <p>Any help would be appreciated.  I did try the following link <a href="https://stackoverflow.com/questions/19828385/pgconnectionbad-could-not-connect-to-server-connection-refused">PG::ConnectionBad - could not connect to server: Connection refused</a></p>
  
  <p>This did not seem to work.</p>