Sunday, October 13, 2013

Running PostgreSQL with rails.

1. Run the PostgreSQL by issuing the following command:

$ sudo /etc/init.d/postgresql start

Expected Output:
 * Starting PostgreSQL 9.1 database server

2. Run your Rails Server using the command:

$ rails server

3. To run your database:  psql -U user_name db_name

4. Enjoy.

Notes: When PostgreSQL is configured it creates a configuration file pg_hba.conf. 

Issues faced:

There was a peer authentication error while running the rails server
Solution:
Change the configuration in the PostgreSQL conf file.

i.e. pg_hba.conf
Issue the following command.

$ sudo nano /etc/postgresql/9.1/main/pg_hba.conf

Update the


local all postgres peer
to
local all postgres md5

That would solve the problem with authentication.  

No comments:

Post a Comment