psql 安装逐步详细指导 - OrlandoLee/youhou GitHub Wiki

database.yml
test:
adapter: postgresql
encoding: unicode
database: youhou_test
pool: 5
#username should be changed to your user name
username: postgres #when test locally change username to local username
password:
host: localhost


1. 假设我们现在已经安装好 rvm,ruby,brew(for mac) 并且已经下载好 postgresql。
下一步,which psql 如果不是 /usr/local/bin/psql 执行 rm -r 你看到的 (移除mac系统自带的psql)
which psql 此时应该显示 /usr/local/bin/psql


2.rails new youhou -d postgresql
initdb /usr/local/var/postgres -E utf8 (如果失败了重启一下电脑)


3.rake db:create:all 如果通过说明成功了,没有通过要修改下 config/database.yml。 记住用户名是你电脑的用户名,然后把host 去掉注释 即让他们生效,此时应该可以运行


start psql server
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start


initdb /usr/local/var/postgres
postgres -D /usr/local/var/postgres

⚠️ **GitHub.com Fallback** ⚠️