createuser: 无法连接到数据库 postgres: 无法连接到服务器: 没有那个文件或目录
createuser: could not connect to database postgres: could not connect to server: No such file or directory
我使用此命令安装了 postgresql on archlinux:
sudo pacman -S postgresql
安装成功。但是当我想创建一个新用户时,像这样:
sudo -iu postgres
[postgres@amirashabani ~]$ createuser amirashabani
我收到此错误:
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"?
我该如何解决这个问题?
问题是我忘记了 start
和 enable
postgresql service, which was mentioned in the ArchWiki:
完成后:
systemctl start postgresql.service
systemctl enable postgresql.service
一切正常。
我使用此命令安装了 postgresql on archlinux:
sudo pacman -S postgresql
安装成功。但是当我想创建一个新用户时,像这样:
sudo -iu postgres
[postgres@amirashabani ~]$ createuser amirashabani
我收到此错误:
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"?
我该如何解决这个问题?
问题是我忘记了 start
和 enable
postgresql service, which was mentioned in the ArchWiki:
完成后:
systemctl start postgresql.service
systemctl enable postgresql.service
一切正常。