How to configure postgresql for the first time?

前端 未结 10 877
太阳男子
太阳男子 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:48

    In MacOS, I followed the below steps to make it work.

    For the first time, after installation, get the username of the system.

    $ cd ~
    $ pwd
    /Users/someuser
    $ psql -d postgres -U someuser
    

    Now that you have logged into the system, and you can create the DB.

    postgres=# create database mydb;
    CREATE DATABASE
    postgres=# create user myuser with encrypted password 'pass123';
    CREATE ROLE
    postgres=# grant all privileges on database mydb to myuser;
    GRANT
    

提交回复
热议问题