highcenoid=# ALTER USER highcenoid CREATEDB;
ALTER ROLE
highcenoid=# GRANT ALL PRIVILEGES ON DATABASE postgres to highcenoid;
GRANT
highcenoid=# ALTER DATABASE postgres owner to highcenoid;
ALTER DATABASE
highcenoid=# GRANT CONNECT ON DATABASE postgres to highcenoid;
GRANT
highcenoid=# \q
Then it spit out
~/Dev/RoR/project master ? rails db:setup ✔
FATAL: permission denied for database "postgres"
DETAIL: User does not have CONNECT privilege.
Couldn't create 'dca9qlbmn4rek1' database. Please check your configuration.
rails aborted!
ActiveRecord::NoDatabaseError: FATAL: permission denied for database "postgres"
DETAIL: User does not have CONNECT privilege.
rails db:migrate actually does it's job and I think rails db:create too. It's just the rails db:setup that messes up our brains.
Wait, so I need to include my user password on the database.yml file?
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: db_name
# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
# When left blank, postgres will use the default role. This is
# the same name as the operating system user that initialized the database.
#username: user_name
# The password associated with the postgres role (username).
#password:
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost
# The TCP port the server listens on. Defaults to 5432.
# If your server runs on a different port number, change accordingly.
#port: 5432
# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public
# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
# Defaults to warning.
#min_messages: notice
Thanks for that detailed reply. I did this:
Then it spit out
I don't know what to do anymore.
Hmm.. I see..
You still have option.
How about altering as superuser?
I did that.
highcenoid is my superuser.
Are there any other options?
can you check all your user permission? use this command
post it here.
Here it is
hahaha.. such strange error!
Hmmm.. if you running other command like
rails db:create
andrails db:migrate
. is that running well too?and can you copy your database.yml also to here? (just delete the password part or it's not possible, just confirm all the value is right)
I know!!!
rails db:migrate
actually does it's job and I thinkrails db:create
too. It's just therails db:setup
that messes up our brains.Wait, so I need to include my user password on the
database.yml
file?Hmmm..
Check it here:
digitalocean.com/community/tutoria...
At those post, They give an example minimal database.yml that can be running for rail apps:
I haven't tried to fix the
database.yml
but I think this will fix it. Thanks Andre! Will let you know if the problem would still be persistent.