---
# System prepended metadata

title: '[Ruby On Rails]將rails專案設定為連線至遠端postgreSQL資料庫'
tags: [Ruby On Rails]

---

# [Ruby On Rails]將rails專案設定為連線至遠端postgreSQL資料庫

###### tags: `Ruby On Rails`

若專案預設使用其他的db:

config/database.yml

```yaml=
development:
  adapter: postgresql
  host: host name
  username: user name
  encoding: unicode
  port: 5432
  database: db name
  password: your password
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

```


修改Gemfile：
```
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
```

terminal

```terminal
bundle install
```
