简体   繁体   中英

Can't connect to db on Heroku

I am following the "getting started" instructions for deploying Rails to Heroku, and I am running into problems when trying to access the DB.

Steps taken:

1) Create a new project

rails new pdfl_4 -d postgresql
rake db:create:all

2) Add to git

git init
git add .
git commit -m "Initial commit"
git push

3) Push to Heroku

heroku login
heroku create
git push heroku master

4) Try to connect to the db

heroku pg:psql

Everything works ok until the last step. Error msg reads "psql: could not connect to server: Connection timed out"

Seems like I'm missing something basic here, but not sure what it is.

As mentioned on heroku documentation for heroku pg:psql ,

you must have PostgreSQL installed on your system to use heroku pg:psql

Follow the instructions for the local setup to get it up and running locally.

I think this might be a Windows issue. My buddy was able to connect to my db from his Mac.

I used Taps to push the local db to Heroku which worked just fine https://github.com/heroku/heroku-taps

Did you run

 heroku run rake db:migrate

or

 heroku db:push  #this will push your ocal db to heroku

?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM