我已经安装了
postgresql 9.5.13,但它似乎无法正常工作.我不断得到这条消息:
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 “/var/run/postgresql/.s.PGSQL.5432”?
当我尝试创建用户时.我已经看到这是常见问题,但我无法找到解决方案.
解决方法
查看该服务是否正在运行
systemctl status postgresql
如果PostgreSQL正在运行,您将看到包含文本Active:active(exited)的输出.
如果您看到Active:inactive(dead),请使用以下命令启动PostgreSQL服务:
systemctl start postgresql
还需要启用PostgreSQL才能重启.使用此命令执行此操作:
systemctl enable postgresql
跑
pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 9.5 main 5433 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log Status - online - fine