Create Db Database Creation Failed Error Role
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the postgres role does not exist mac workings and policies of this site About Us Learn more about
Createdb: Database Creation Failed: Error: Permission Denied To Create Database
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions psql fatal database username does not exist 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.
Pg::insufficientprivilege: Error: Permission Denied To Create Database
Join them; it only takes a minute: Sign up PostgreSQL error: Fatal: role “username” does not exist up vote 304 down vote favorite 101 I'm setting up my PostgreSQL 9.1. I can't do anything with PostgreSQL: can't createdb, can't createuser; all operations return the error message Fatal: role h9uest does not exist h9uest is my account name, and I psql fatal role does not exist windows sudo apt-get install PostgreSQL 9.1 under this account. Similar error persists for the root account. postgresql share|improve this question edited Feb 4 at 0:52 Kara 3,12873147 asked Aug 12 '12 at 3:00 h9uest 1,8273814 1 Afterwards you might run into FATAL: role "user" is not permitted to log in, check dba.stackexchange.com/questions/57723/… for that. –Kasper Souren Sep 18 '14 at 14:32 5 I answered this question here. Read this tutorial too "How to Install Postgres for Ubuntu Linux". –Ruzenhack Jul 29 '15 at 23:01 @Ruzenhack that tutorial link was exactly what I needed! Very clear and simple –dwanderson Sep 25 '15 at 22:36 add a comment| 6 Answers 6 active oldest votes up vote 353 down vote accepted You probably need to use the system user postgres to create your database - as long as you haven't set up (and given the necessary privileges to) a database user named "h9uest" that corresponds to your system user of the same name, so it is enabled by the default ident authentication method. sudo
Logs with LogRotate Setting Up Rails 4 with MongoDB and Mongoid Using Vagrant for Rails Development Community Pricing Login Sign Up Home Screencasts Community Account ← Back to the forum setup
Sudo: Unknown User: Postgres
Postgres user fails Anthony Candaele commented on Sep 03, 2014: Hi, I'm following the
Fatal Role Does Not Exist Rails
Deploy Rails guide I'm now a the part where Postgres gets installed. I successfully installed Postgres, but when I try createuser: could not connect to database postgres: fatal: role "postgres" does not exist to create a new Postgres user with: createuser --pwprompt , I'm getting this message: creation of new role failed: ERROR: role "postgres" already exists anyone knows what's going on? thanks for your help, http://stackoverflow.com/questions/11919391/postgresql-error-fatal-role-username-does-not-exist Anthony Chris Oliver Subscriber commented on Sep 04, 2014: I think that's because the postgres user already exists. You can do the following to drop the user and create it from scratch: sudo su postgres dropuser postgres createuser --pwprompt Anthony Candaele commented on Sep 04, 2014: when I switch to the postgres user and run dropuser postgres I get dropuser: removal of role "postgres" failed: ERROR: current user https://gorails.com/forum/setup-postgres-user-fails cannot be dropped James Jelinek Subscriber commented on Sep 26, 2014: Did you install Postgres via homebrew on your development machine? Or is this in production? If you installed it locally (especially in OSX) you can access the Postgres cli by simply typing psql and it will use your current credentials to log you into the cli. From there you can create/delete/modify databases/roles/etc. Anthony Candaele commented on Nov 06, 2014: @James, I'm not installing Postgres on my development machine, I'm installing it on the production server. For the moment I'm deploying another Rails application, and I'm running in exactly the same problem as mentioned in this post, when I type: createuser --pwprompt I'm still getting the error message: creation of new role failed: ERROR: role "postgres" already exists Anthony Candaele commented on Nov 06, 2014: now I'm finally getting it: sudo su - postgres createuser --pwprompt exit it was the line createuser --pwprompt that confuses me, I typed this litteraly in the command line, while I should specify the user I want to create, for instance: create deploy --pwprompt I think it would be clearer if it was specified in the deploy guide like this: create [name of user] --pwpro
not connect to database postgres: FATAL: Peer authentication failed for user "postgres" Posted by: Yang , July 7, 2014 Question: Create postgres database # createdb mydb response could be like this: createdb: could not connect http://learn.linksprite.com/pcduino/linux-applications/postgresql-createdb-could-not-connect-to-database-postgres-fatal-peer-authentication-failed-for-user-postgres/ to database postgres: FATAL: role "root" does not exist createdb: could not connect http://dba.stackexchange.com/questions/96368/creating-a-database-under-a-different-owner to database template1: FATAL: role "root" does not exist where your own login name is mentioned. This will happen if the administrator has not created a PostgreSQL user account for you. (PostgreSQL user accounts are distinct from operating system user accounts.) If you are the administrator, see Chapter 20 for does not help creating accounts. You will need to become the operating system user under which PostgreSQL was installed (usually postgres) to create the first user account. It could also be that you were assigned a PostgreSQL user name that is different from your operating system user name; in that case you need to use the -U switch or set the PGUSER environment variable to specify does not exist your PostgreSQL user name. # createdb mydb -U postgres response could be like this: createdb: database creation failed: ERROR: permission denied to create database Not every user has authorization to create new databases. If PostgreSQL refuses to create databases for you then the site administrator needs to grant you permission to create databases. Consult your site administrator if this occurs. If you installed PostgreSQL yourself then you should log in for the purposes of this tutorial under the user account that you started the server as. You can also create databases with other names. PostgreSQL allows you to create any number of databases at a given site. Database names must have an alphabetic first character and are limited to 63 bytes in length. A convenient choice is to create a database with the same name as your current user name. Many tools assume that database name as the default, so it can save you some typing. How to Fix : Step 1: edit pg_hba.conf file # sudo nano /etc/postgresql/9.3/main/pg_hba.conf Step 2 : change " peer " to pcDuino Ubuntu user , such as " root " Look a
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 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 Database Administrators Questions Tags 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 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 Creating a database under a different owner up vote 3 down vote favorite 3 I'm trying to set up a role in Postgres which can a) Create a new Role b) Create a new Database c) Make that new Role the owner of the database d) Have no other rights (as far as is possible!) I have tried this: sc_1=# CREATE ROLE tenant_admin CREATEDB CREATEROLE; CREATE ROLE sc_1=# CREATE ROLE user1 IN ROLE tenant_admin LOGIN NOINHERIT ENCRYPTED PASSWORD 'xyz'; CREATE ROLE sc_1=# Followed by (in another session) tahaan@Komputer:~/projects/acme-project$ psql -U user1 -h localhost -d postgres Password for user user1: psql (9.3.6) SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256) Type "help" for help. postgres=> SET ROLE tenant_admin; SET postgres=> CREATE DATABASE "Tenant1" TEMPLATE "tenant_template"; CREATE DATABASE postgres=> CREATE ROLE "owner1"; CREATE ROLE postgres=> ALTER DATABASE "Tenant1" OWNER TO "owner1"; ERROR: must be member of role "owner1" postgres=> Background: The requirement is to have an automated function that can setup separate databases in a multi-tenant system. My hope is that this function can be performed by a role that does not have too much rights. postgresql security permissions share|improve this question asked Mar 26 '15 at 18:13 Johan 184110 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote I found a solution involving a few extra steps. The "tenant_admin" role is still created the same way, but it is now used as follow: postgres=> SET ROLE tenant_admin; SET postgres=> CREATE ROLE "owner3"; CREATE ROLE postgres=> GRANT "owner3" TO "tenant_admin"; GRANT ROLE postgres=> CREATE DATABASE "Tenant3" OWNER "owner3"; CREATE DATABASE postgres=> REVOKE "owner3" from "tenant_admin"; REVOKE ROLE share|improve this answer answered Mar 26 '15 at 18:21