更新时间:2021-12-08 08:33:41
如果你在你的服务器上安装了 postresql,那么只需将主机:localhost 放到 database.yml,我通常会把它放在它说 pool: 5 的地方.否则如果它是不是 localhost 肯定会告诉该应用程序在哪里可以找到它的数据库.
If you installed postresql on your server then just host: localhost to database.yml, I usually throw it in around where it says pool: 5. Otherwise if it's not localhost definitely tell that app where to find its database.
development:
adapter: postgresql
encoding: unicode
database: kickrstack_development
host: localhost
pool: 5
username: kickrstack
password: secret
通过创建数据库并将所有权分配给应用的用户以建立连接,确保您的用户凭据设置正确.要在 postgresql 9 中创建一个新用户,请运行:
Make sure your user credentials are set correctly by creating a database and assigning ownership to your app's user to establish the connection. To create a new user in postgresql 9 run:
sudo -u postgres psql
如果还没有设置 postgresql 用户密码,它只是反斜杠密码.
set the postgresql user password if you haven't, it's just backslash password.
postgres=# password
创建新用户和密码以及用户的新数据库:
Create a new user and password and the user's new database:
postgres=# create user "guy_on_***" with password 'keepitonthedl';
postgres=# create database "dcaclab_development" owner "guy_on_***";
在您确认创建数据库、用户、密码并设置这些权限后,现在更新您的 database.yml 文件.不要忘记主机:localhost.
Now update your database.yml file after you've confirmed creating the database, user, password and set these privileges. Don't forget host: localhost.