Error Permission Denied To Create Database Pgsql
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn permission denied for database postgres more about hiring developers or posting ads with us Super User Questions Tags Users Badges Unanswered
Permission Denied For Database Postgres Detail User Does Not Have Connect Privilege
Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a
Permission Denied For Database Postgres Heroku
minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top User permissions for creating PostgreSQL DB up vote 13 down vote favorite 6
Error Permission Denied For Relation Postgres
I'm working on Ubuntu. Following is one of my commands. $ psql -U kuser -d postgres Then this connects to the database. But from postgres terminal when i try postgres=> CREATE DATABASE kdb; ERROR: permission denied to create database When I try a similar command in Ubuntu, it gives the following $ sudo -u kuser createdb kdb sudo: unknown user: kuser sudo: unable to initialize policy plugin How do I create this DB?. I have sudo rights error permission denied for relation postgresql and kuser is not me. postgresql share|improve this question edited Nov 19 '12 at 15:19 qqx 1,863711 asked Nov 19 '12 at 15:03 dinesh707 175114 add a comment| 1 Answer 1 active oldest votes up vote 28 down vote accepted It appears that you have a database user named kuser, but there is no system user with that name. This is why you're able to get a postgres prompt as that user, but sudo fails. That user isn't able to create a database, because that account doesn't have the necessary permission. You can either grant that permission to the user, using the postgres account which is the default management account on Ubuntu: sudo -u postgres psql -c 'alter user kuser with createdb' postgres Or you can just use that management account to create the database, and specify that it is owned by the kuser account: sudo -u postgres createdb -O kuser kdb If that user isn't going to be creating other databases I'd advise using the latter option, better to limit the privileges that are granted to the account. share|improve this answer answered Nov 19 '12 at 15:25 qqx 1,863711 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the postgres grant user permission to create database workings and policies of this site About Us Learn more about Stack database creation error: permission denied to create database odoo Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags rails postgres permission denied to create database Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from http://superuser.com/questions/507721/user-permissions-for-creating-postgresql-db others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Granting a user account permission to create databases in PostgreSQL up vote 54 down vote favorite 9 How do I give a user account http://dba.stackexchange.com/questions/33285/granting-a-user-account-permission-to-create-databases-in-postgresql in PostgreSQL the ability to create and drop databases? Is there a way to do this with GRANT? postgresql permissions share|improve this question edited Oct 18 '15 at 5:39 Paul White♦ 29.6k11165264 asked Jan 21 '13 at 20:28 GSto 373136 add a comment| 2 Answers 2 active oldest votes up vote 83 down vote accepted It's done with ALTER USER username CREATEDB; See ALTER USER in the doc. To drop a database, either you're superuser (which can be granted with ALTER USER too) or you must own the database. share|improve this answer answered Jan 21 '13 at 21:57 Daniel Vérité 10.2k11435 add a comment| up vote 17 down vote First, you have to login as postgres user: $ sudo -u postgres psql postgres # \password postgres Enter new password: After entering new password for postgres user (special kind of user on PostgreSQL), you are now logged in as postgres and you can grant permission to other users. Let's say you have user named user1. To grant him ability to create and drop databases, you have to write (as
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow http://stackoverflow.com/questions/28116927/postgres-permission-denied-to-create-database-on-rake-dbcreateall the company Business Learn more about hiring developers or posting ads with us Stack http://stackoverflow.com/questions/15791406/logged-in-as-postgres-but-getting-the-error-createuser-creation-of-new-role-fai Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Postgres permission denied to create database on rake db:create:all up vote 10 down vote favorite 1 I am permission denied trying to create postgres databases for development and tests. I'm using... OSX Yosemite Rails version: 4.2.0 git version: 2.2.2 psql version: 9.4.0 ruby version: 2.1.0p0 HomeBrew version: 0.9.5 Gemfile... gem 'pg' database.yml default: &default adapter: postgresql encoding: unicode pool: 5 development: <<: *default database: myapp_development username: username password: test: <<: *default database: myapp_test rake db:create:all returns PG::InsufficientPrivilege: ERROR: permission denied to create database : CREATE DATABASE "myapp_development" ENCODING = 'unicode' .... (lots permission denied for of tracing) Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"myapp_development", "username"=>"username", "password"=>nil} myapp_test already exists What is wrong? EDIT I just tried changing the username in the database.yml to my username that I'm using on my Mac. It worked. It also told me that not only maybe_test' already exists, but it also just told me thatmyapp_development` already exists too. Why wouldn't it be able to use the other username that I had created and assigned a role to CREATEDB? Why did it say that the development couldn't be created then tell me that it already existed? This all seems way too confusing and reminds me of php setup with apache back in the very old days. I don't want to have to deal with problems every time I create a new app and try to follow the heroku recommendations to use postgres during development too. ruby-on-rails ruby postgresql share|improve this question edited Jan 23 '15 at 19:10 asked Jan 23 '15 at 19:03 Beengie 599519 1 rake db:drop:all then rake db:create:all –Малъ Скрылевъ Jan 23 '15 at 19:07 2 Follow this answer to give your used CREATEDB role. And your problem will be resolved. And do rake db:drop and rake db:create. –Arup Rakshit Jan 23 '15 at 19:11 add a comment| 2 Answers
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Logged in as postgres but getting the error createuser: creation of new role failed: ERROR: must be superuser to create superusers up vote 1 down vote favorite 1 I need to create a superuser so I can create a db, but I'm having trouble with this. I'm logged in as the user postgres: sudo su - postgres But when I try to create a superuser, I get the following problem: $createuser glassboard; Shall the new role be a superuser? (y/n) y createuser: creation of new role failed: ERROR: must be superuser to create superusers This also happens if I try to create a new user in psql and then make him a superuser: $ psql -U postgres psql (9.1.4) Type "help" for help. postgres=> create user glassboard postgres-> ; ERROR: permission denied to create role How do I create a superuser? output of \du in postgres: postgres=> \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------+----------- main | Superuser, Create role, Create DB, Replication | {} postgres | | {} postgresql share|improve this question edited Apr 3 '13 at 18:42 asked Apr 3 '13 at 15:19 Eric Baldwin 98721534 Apparently your postgres user is not superuser which is weird. When you're inside psql, can you issue \du add the output to your question? I suspect you're using some OSX package such as postgres.app with non-standard defaults compared to Unix. –Daniel Vérité Apr 3 '13 at 18:20 I added this info to my question. How can I give