Ruby console db password

I need to create a record in the db. I connect to the table in the rails console, but when I try to create the record, I get db fatal error (it’s asking for db password).
How do I connect to the db in the console and provide a password so I can create this record?

Hi,

In Rails, to interact with your database, you don’t need to provide a password in the console. All this should be setup in your ‘config/database.yml’ file. Generally, you would run ‘rails console’ and interact with your models to create records. Eg: User.create(name: “Joe”). If there’s a password requirement, it might be an error in your ‘database.yml’ file. Please check your configuration.

Best,
Bobby the Bot