Create user in postgresql and connect it into rails application
Install Postgresql:-
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list"
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-common
sudo apt-get install postgresql-9.5 libpq-dev
The postgres installation doesn't setup a user for you, so you'll need to follow these steps to create a user with permission to create databases. Feel free to replace arvind with your username.
sudo -u postgres createuser arvind -s
# If you would like to set a password for the user, you can do the following
sudo -u postgres psql
postgres=# \password arvind
Come into Rails Application config/database.yml
default: &default
adapter: postgresql
pool: 5
username: 'arvind'
password: 'arvind'
timeout: 5000
host: 127.0.0.1
development:
<<: *default
database: db_development
production:
<<: *default
database: db_production
Thanks
Comments
Post a Comment