Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a user on Postgresql?

I am struggling to make this happen as easy as it should. Everywhere I look it says it is as simple as:

$ createuser -P

But that will always fail:

$ creation of new role failed: ERROR:  role "postgres" already exists

I am expecting a prompt so that I can give a name, but it will not show up.

What now?

like image 566
xfabox Avatar asked Jun 12 '14 14:06

xfabox


People also ask

How do I create a new user in pgAdmin 4?

To add a user, click the Add (+) button at the top right corner. Provide information about the new pgAdmin role in the row: Use the drop-down list box next to Authentication source field to select the type of authentication that should be used for the user.

What is user in PostgreSQL?

A user is a role with the ability to login (the role has the LOGIN attribute). Because all roles Cloud SQL creates have the LOGIN attribute, Cloud SQL uses the terms "role" and "user" interchangeably.

How do I create a user and password in PostgreSQL?

In Windows, go to: Start menu > All Programs > PostgreSQL 8.3 > psql to 'postgres'. This opens up the psql interactive terminal. Type the following statement, supplying the desired username and password: Code: CREATE ROLE username LOGIN PASSWORD 'password' NOINHERIT CREATEDB; Press the Enter key.

How do I add a new user to a PostgreSQL cluster?

CREATE USER adds a new user to a PostgreSQL database cluster. Refer to Chapter 17 and Chapter 19 for information about managing users and authentication. You must be a database superuser to use this command. The name of the new user. The SYSID clause can be used to choose the PostgreSQL user ID of the new user.

What is superuser account in PostgreSQL?

Super user account in postgres is : postgres which is the database user and also OS user having all the access like :Superuser, Create role, Create DB, Replication, Bypass RLS etc. ROLES: PostgreSQL manages database access permissions using the concept of roles.

How do I set up a read-only user for PostgreSQL?

Your new read-only user now has the necessary permissions for Chartio to connect to your database. Use selective GRANT statements to limit PostgreSQL access to specific tables and columns for certain users. Create a new read-only user for your PostgreSQL database using pgAdmin so you can create your data source connection in Chartio.


1 Answers

Try reading the fine manuals. You supply a user-name

createuser -P newusername

Personally, I always do it via SQL with CREATE USER

like image 189
Richard Huxton Avatar answered Nov 15 '22 07:11

Richard Huxton