I am able to create databases (development, test, and production
databases) as follows
.................................................................
ajit@ajit:~$ su - postgres
Password:
postgres@ajit:~$ psql
postgres=# create DATABASE book_shelf_development;
CREATE DATABASE
postgres=# create DATABASE book_shelf_test;
CREATE DATABASE
postgres=# create DATABASE book_shelf_production;
CREATE DATABASE
postgres=#

................................................................

But when I try to create same databases using the command
'rake db:create:all', I am getting an error massage saying 'FATAL:
Ident authentication failed for user "postgres"'. And none of the
databases are created.

And also after creating databases as shown above, I created migration
files and I am able to do rake db:migrate for the same database.yml
file.


Can you please help me why 'rake db:create:all' is not working?

Thank you
Ajit

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Feb 1, 2012 at 8:59 am

    On 1 February 2012 06:59, Ajit Teli wrote:
    I am able to create databases (development, test, and production
    databases) as follows
    .................................................................
    ajit@ajit:~$ su - postgres
    Password:
    postgres@ajit:~$ psql
    postgres=# create DATABASE book_shelf_development;
    CREATE DATABASE
    postgres=# create DATABASE book_shelf_test;
    CREATE DATABASE
    postgres=# create DATABASE book_shelf_production;
    CREATE DATABASE
    postgres=#

    ................................................................

    But when I try to create same databases using the command
    'rake db:create:all', I am getting an error massage saying 'FATAL:
    Ident authentication failed for user "postgres"'. And none of the
    databases are created.

    And also after creating databases as shown above, I created migration
    files and I am able to do rake db:migrate for the same database.yml
    file.
    Possibly you have the correct user/password for the development db but
    not for one of the others. Try using create to create them one at a
    time and see if one fails. Also check the yml file very carefully for
    small errors. Possibly copy/paste the user/password lines from the
    development section to the others.

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Craig White at Feb 1, 2012 at 3:24 pm

    On Jan 31, 2012, at 11:59 PM, Ajit Teli wrote:

    I am able to create databases (development, test, and production
    databases) as follows
    .................................................................
    ajit@ajit:~$ su - postgres
    Password:
    postgres@ajit:~$ psql
    postgres=# create DATABASE book_shelf_development;
    CREATE DATABASE
    postgres=# create DATABASE book_shelf_test;
    CREATE DATABASE
    postgres=# create DATABASE book_shelf_production;
    CREATE DATABASE
    postgres=#

    ................................................................

    But when I try to create same databases using the command
    'rake db:create:all', I am getting an error massage saying 'FATAL:
    Ident authentication failed for user "postgres"'. And none of the
    databases are created.

    And also after creating databases as shown above, I created migration
    files and I am able to do rake db:migrate for the same database.yml
    file.


    Can you please help me why 'rake db:create:all' is not working?
    ----
    not a rails issue but an issue from not understanding postgresql.

    probably a bad idea to use 'postgres' as the user/owner of a database and postgres has users/roles/grants functionality for the purpose of program interface with the postgres server.

    if you are intent on using postgres without gaining any knowledge about it's authentication mechanisms, then you should understand that user postgres doesn't have a password and out of the box, can only use the localhost postgresql server via a local socket (not TCP/IP) - thus database.yml shouldn't have a password, a port # or anything but the actual local socket (/var/run/postgresql/$SOME_PID_FILE ?)

    Craig

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Peter Vandenabeele at Feb 1, 2012 at 4:11 pm
    On Wed, Feb 1, 2012 at 4:24 PM, Craig White wrote:
    On Jan 31, 2012, at 11:59 PM, Ajit Teli wrote:

    I am able to create databases (development, test, and production
    databases) as follows
    .................................................................
    ajit@ajit:~$ su - postgres
    Password:
    postgres@ajit:~$ psql
    postgres=# create DATABASE book_shelf_development;
    CREATE DATABASE
    postgres=# create DATABASE book_shelf_test;
    CREATE DATABASE
    postgres=# create DATABASE book_shelf_production;
    CREATE DATABASE
    postgres=#

    ................................................................

    But when I try to create same databases using the command
    'rake db:create:all', I am getting an error massage saying 'FATAL:
    Ident authentication failed for user "postgres"'. And none of the
    databases are created.

    And also after creating databases as shown above, I created migration
    files and I am able to do rake db:migrate for the same database.yml
    file.


    Can you please help me why 'rake db:create:all' is not working?
    ----
    not a rails issue but an issue from not understanding postgresql.

    probably a bad idea to use 'postgres' as the user/owner of a database and
    postgres has users/roles/grants functionality for the purpose of program
    interface with the postgres server.

    if you are intent on using postgres without gaining any knowledge about
    it's authentication mechanisms, then you should understand that user
    postgres doesn't have a password and out of the box, can only use the
    localhost postgresql server via a local socket (not TCP/IP) - thus
    database.yml shouldn't have a password, a port # or anything but the actual
    local socket (/var/run/postgresql/$SOME_PID_FILE ?)
    Maybe the practical solution for the OP then is to do

    $ createuser ajit
    Shall the new role be a superuser? (y/n) y

    and that will at least reduce the need to use the 'postgres' user.

    In that case the database.yml could look like

    development:
    adapter: postgresql
    encoding: unicode
    pool: 5
    min_messages: log

    As described by Craig.

    Do NOT mention localhost (then you will go over local socket, using the
    user authentication of user 'ajit' to get in locally).

    HTH,

    Peter

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 1, '12 at 6:59a
activeFeb 1, '12 at 4:11p
posts4
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase