1

I installed on using this command:

sudo pacman -S postgresql

And it installed OK. But when I want to create a new user, like this:

sudo -iu postgres
[postgres@amirashabani ~]$ createuser amirashabani

I receive this error:

createuser: could not connect to database postgres: 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"?

How can I fix this?

1 Answers1

0

The problem was that I forgot to start and enable the service, which was mentioned in the ArchWiki:

Finally, start and enable the postgresql.service.

After doing this:

systemctl start postgresql.service
systemctl enable postgresql.service 

Everything worked fine.