I created a new rails project rails new devise_gem_app -d postgresql
and changed config/database.yml
to these:
default: &default
adapter: postgresql
encoding: unicode
username: devise_gem_app
password: devise_gem_app
host: localhost
development:
<<: *default
database: devise_gem_app_development
test:
<<: *default
database: devise_gem_app_test
But I don't know how to connect the user to this batabase
I create a user like this: createuser devise_gem_app -W
set it as a super user and I set password to: devise_gem_app.
But when I try rake db:migrate
I get:
PG::ConnectionBad: FATAL: password authentication failed for user "devise_gem_app"
FATAL: password authentication failed for user "devise_gem_app"
I even chenged last line of pg_hbf.conf
to:
#local replication postgres trust
... and nothing ...
I know this should be easy but I just don't see what am I doing wrong.
我不确定createuser
命令在做什么,但是您始终可以直接在postgres中为devise_gem_app
用户设置密码。
ALTER user devise_gem_app WITH password 'devise_gem_app';
create user user_name with password 'password' createdb;
And in pg_hbf.conf
file
#Database administrative login by Unix domain socket
local all postgres peer
In the end I ended following this tutorial: http://www.cyberciti.biz/faq/howto-add-postgresql-user-account/
But I am upset that it seems rails don`t support, creating new users for new projects db, which seems to be common practice.
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.