Created
October 12, 2017 16:28
-
-
Save radinreth/f034b994259f00b2194fc7ccf135faf8 to your computer and use it in GitHub Desktop.
Revisions
-
radinreth created this gist
Oct 12, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ # https://stackoverflow.com/questions/28116927/postgres-permission-denied-to-create-database-on-rake-dbcreateall I have faced same issues when running rake db:test:prepare in postgresql on my Ruby on Rails project. This is pretty clear from the error message, that its a permission issue for the user. I added CREATEDB permission for new_user as following from the console. To access postgres console: $ sudo -u postgres -i postgres@host:~$ psql In there: postgres=# ALTER USER new_user CREATEDB; It's working perfect for now. You may have another issues with database ownership, for this you can change database privileges and owner as following command. postgres=# GRANT ALL PRIVILEGES ON DATABASE database_name to new_user; postgres=# ALTER DATABASE database_name owner to new_user; then sudo service postgresql restart then rake db:reset