1

I am using a postgresql on Ubuntu. It already has my username testuser that I have checked using the following command:

\du

But whenever I create a database, it says that the owner is postgres:

create database tempdb;

I want the user of tempdb to be tempuser rather than postgres. Could you tell me how can I do that?

2 Answers 2

1

try:

CREATE DATABASE tempdb OWNER testuser;

as per docs

Sign up to request clarification or add additional context in comments.

Comments

0

Are you using psql? If so, the --username flag will allow you to connect as testuser.

2 Comments

I have logged in using the following command: sudo -u postgres psql
Sounds like you already solved your issue, but sudo -u postgres psql --username testuser might also help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.