ChirpStack ·

CreateDB: Error: Local user with ID 1001 does not exists

Learn how to fix the "could not connect to database" error in PostgreSQL by executing the command as the user 'postgres'.

Solution

If you encounter the error "createDB: Error: Local user with ID 1001 does not exists" while trying to create a new database in PostgreSQL, follow these steps to fix the issue:

Execute the command as the user postgres instead of your current user. For example, to create a new database named chirpns, run:

createdb -U postgres chirpns

This command creates a new database named chirpns with the user postgres as the owner. You can replace chirpns with the name of your desired database.

Note: If you don't know the password for the postgres user, you can reset it by running:

sudo -u postgres psql \password postgres

This will prompt you to enter a new password for the postgres user.

Read next

Share, Engage, and Contribute!

Discover how you can share your ideas, contribute to our blog, and connect with us on other platforms.