postgres pg_dump database from AWS RDS

Run the below command from your terminal

pg_dump -h <host> -U <username> -f <filename>.sql
 <database-name>

If you only want to download schema of the database add --schema-only

pg_dump -h <host> -U <username> -f <filename>.sql --schema-only <database-name>

PG: Connection to localhost:5432 refused

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”

$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql

another solution that worked for me https://dba.stackexchange.com/a/209337

Upgrade Heroku Postgres to Hobby Basic Plan

  • heroku maintenance:on –remote testing
  • heroku addons:create heroku-postgresql:hobby-basic –remote testing
  • heroku pg:wait –remote testing
  • heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_ORANGE_URL –remote testing
  • heroku pg:promote HEROKU_POSTGRESQL_ORANGE_URL –remote testing
  • heroku pg:info –remote testing
  • heroku maintenance:off –remote testing