Search code examples
postgresqlmanjaro

Where is pg_hba.conf is located in Manjaro


So, I have installed PostgreSQL 10.1 in my Linux Manjaro 17.1.1 using yaourt installer package.

yaourt -S postgresql

From here I can't connect the database locally, so, when searching I found this stackoverflow posting which tells me that I should find pg_hba.conf file (step 3)

I tried to find the pg_hba.conf file using this command in terminal

sudo find / -name *pg_hba*`

but still can't find the file, instead I only found a sample file here:

/usr/share/postgresql/pg_hba.conf.sample

I tried to reinstall the package using yaourt again, but still it doesn't work. Am I missing something?

Thanks

UPDATE

So, here is the error that I get when trying to connect to the database.

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?

Solution

  • So, I just solve the problem a few minutes after I posted it. And stupid me, I didn't read carefully the instruction from this page.

    Apparently, I need some more steps to finish the installation. I need to run the command below:

    Before PostgreSQL can function correctly, the database cluster must be initialized:

    [postgres]$ initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
    

    Then, start and enable the postgresql.service:

    As root, start and enable postgresql.service. See #Upgrading PostgreSQL for necessary steps before installing new versions of the PostgreSQL packages.

    Now, after the installation finished, I can find the config file using the command below.

    sudo find / -name pg_hba.conf