2016-11-24 63 views
0

我看着铁轨和抓屏我做:Rails应用程序的Postgres角色不存在

brew install postgresql 

initdb /usr/local/var/postgres 

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

rails new ispiti_postgres -d postgresql 

bundle install 

我启动了服务器,我得到这个错误:

Read error: ActiveRecord::NoDatabaseError: FATAL: role "darko" does not exist

然后我尝试这样做:

[email protected] ~/Documents/pokusi/ispiti_postgres $ bundle exec rake db:create:all 
FATAL: role "darko" does not exist 
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"ispiti_postgres_development"} 
rake aborted! 

我试着在postgresdatabase.yaml改变用户名,darkoroot随后命令轨分贝但每次我得到例如时间:

[email protected] ~/Documents/pokusi/ispiti_postgres $ rails db

psql: FATAL: role "root" does not exist

我想一个没有用户名和我还是得到了这个角色darko不存在的消息。我不知道如何访问postgres。我试试这个:

[email protected] ~/Documents/pokusi/ispiti_postgres $ sudo -u postgres -i 

[sudo] password for darko: 

[email protected] ~ $ psql 

psql: FATAL: role "postgres" does not exist 

感谢

+0

你声明'usernaname'你的'database.yml'文件? – inye

+0

我尝试了没有用户名和不同的用户名。 – piga

+0

我想你必须先在postgresql中创建数据库和用户? ('CREATE USER ...'和'CREATE DATABASE ...'和'GRANT ALL PRIVILEGES..' like like(this)[https://www.cyberciti.biz/faq/howto-add-postgresql-user-帐户/]) – inye

回答

0

我使用Linux 32位和LinuxBrew只能安装在64位系统。所以brew命令不起作用。

相关问题