Когда я пытаюсь создать новое приложение rails с postgres db, я не могу выполнить команду rake.Ruby on Rails - db: create: all error
Это то, что я сделал.
[email protected]:~$ sudo -u postgres psql postgres
[sudo] password for sayth:
psql (9.2.4)
Type "help" for help.
postgres=# create role sayth login createdb;
ERROR: role "sayth" already exists
postgres=# DROP user sayth;
DROP ROLE
postgres=# create role sayth login createdb;
CREATE ROLE
postgres=# initdb -D /usr/local/pgsql/data
postgres-# \q
[email protected]:~$
Я создал свой рельсы приложение с
rails new testapp2 -d postgres
понял после просмотра Railscast, почему он не работает http://railscasts.com/episodes/342-migrating-to-postgresql
Так что я редактировал конфиг/database.yml
development:
adapter: postgresql
encoding: unicode
database: testapp2_development
pool: 5
username: sayth
password:
test:
adapter: postgresql
encoding: unicode
database: testapp2_test
pool: 5
username: sayth
password:
Но все равно грабли не создадут мою базу данных.
[email protected]:~/testapp2$ rake db:create:all
FATAL: Peer authentication failed for user "testapp2"
...
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"testapp2_production", "pool"=>5, "username"=>"testapp2", "password"=>nil}
Кажется, что я много читал и пробовал все, что нашел, но не уверен, что делать.
Эта команда также не работает.
[email protected]:~/testapp2/config$ psql -U postgres
psql: FATAL: Peer authentication failed for user "postgres"
У Вас есть пароль для Postgres, если да, то укажите он, и указать порт, который по умолчанию равен 5432 –
@SachinSingh У меня нет пароля, где я укажу порт? – sayth
в database.yml, как и другие атрибуты –