How to configure postgresql for the first time?

前端 未结 10 874
太阳男子
太阳男子 2020-11-28 16:54

I have just installed postgresql and I specified password x during installation. When I try to do createdb and specify any password I get the message:

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 17:58

    Under Linux PostgresQL is usually configured to allow the root user to login as the postgres superuser postgres from the shell (console or ssh).

    $ psql -U postgres
    

    Then you would just create a new database as usual:

    CREATE ROLE myuser LOGIN password 'secret';
    CREATE DATABASE mydatabase ENCODING 'UTF8' OWNER myuser;
    

    This should work without touching pg_hba.conf. If you want to be able to do this using some GUI tool over the network - then you would need to mess with pg_hba.conf.

提交回复
热议问题