psql 无法添加超级用户

报错 psql: FATAL: database "XXXX" does not exist

Some OSX packages don't create a postgres superuser database account. The superuser is named differently, in your case it's main.

When you do psql -U main without specifying a database, it defaults to the same name as the user. If you don't have a database named main, indicate a different database with the -d option.

If you have no database to connect to, use template1

psql -U main -d template1
If still you want to grant superuser to postgres, do once logged inside psql:

alter user postgres superuser;

原文地址:https://www.cnblogs.com/chenzhenzhen/p/7495978.html