[英]Rails db:create failing with Postgres, claiming role doesn't exist when it does
[英]Rails app Postgres role doesn't exist
我看了Rails的截屏视频,然后做完了:
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
我启动了服务器,但出现此错误:
读取错误:ActiveRecord :: NoDatabaseError:严重:角色“ darko”不存在
然后我尝试了这个:
darko@darko-Lenovo-G570 ~/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!
我尝试在postgres
, darko
, root
和随后的rails db中更改database.yaml
中的用户名,但是每次得到例如:
darko @ darko-Lenovo-G570〜/ Documents / pokusi / ispiti_postgres $ rails db
psql:致命错误:角色“根”不存在
我尝试使用没有用户名的尝试,但仍然收到消息说角色darko
不存在。
我不知道如何访问postgres
。 我尝试这样:
darko@darko-Lenovo-G570 ~/Documents/pokusi/ispiti_postgres $ sudo -u postgres -i
[sudo] password for darko:
postgres@darko-Lenovo-G570 ~ $ psql
psql: FATAL: role "postgres" does not exist
谢谢
我正在使用32位Linux,LinuxBrew只能安装在64位系统上。 因此brew命令不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.