createdb: could not connect to database template1: FATAL: password authentication failed for user

21,879

The issue is the username in this command: sudo su postgres -c 'createuser -P --superuser madelek13'

Notice the username not the same as the user's account name: madeleke13. There's an 'e' missing in the username provided to the createuser command, thus the failed authentication.

Share:
21,879
Mike Adeleke
Author by

Mike Adeleke

20 year old Founder of Edopter HQ. The ultimate social network for early adopters. Discover new products with your friends.

Updated on May 04, 2020

Comments

  • Mike Adeleke
    Mike Adeleke about 4 years

    Installed Postgresql via Homebrew. I wanted to create a new database after unzipping a ".tar". But I have this problem.

    Michael-Adelekes-MacBook:wikiful madeleke13$ sudo su postgres -c 'createuser-P--superuser madeleke13'

    bash: createuser-P--superuser: command not found

    Michael-Adelekes-MacBook:wikiful madeleke13$ sudo su postgres -c 'createuser-P-superuser madeleke13'

    bash: createuser-P-superuser: command not found

    Michael-Adelekes-MacBook:wikiful madeleke13$ sudo su postgres -c 'createuser -P --superuser madelek13'

    Password: Enter password for new role: Enter it again:

    Michael-Adelekes-MacBook:wikiful madeleke13$ createdb -T template0

    newdbPassword:
    Password:

    createdb: could not connect to database template1: FATAL: password authentication failed for user "madeleke13"

    Michael-Adelekes-MacBook:wikiful madeleke13$

    I am not understanding why I'm unable to authenticate my username when I have had no problems before.