Search code examples
postgresqlpsql

psql takes macOS user and not postgres


whenever I enter psql in the terminal, the prompt for the password comes up as desired. But the problem is that the username always has the name of my Macbook-Username(tk-first). But the username should be postgres. Can this be changed permanently?

Many thanks in advance!

PostgreSQL V15 Ventura 13.3.1

I have to write the following command every time. Surely that has to be changed?


Solution

  • Put this line in your ~/.zprofile:

    export PGUSER=postgres
    

    After doing so, open a new Terminal window and try psql.