当我在linux debian版本安装postgres数据库遇到的问题:
root@VM-8-13-debian:~# sudo su - postgres
postgres@VM-8-13-debian:~$ psql
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and a***epting connections on that socket?
帮我解决成功的方法如下:可以直接复制运行,需要看注释
步骤一:
dpkg-reconfigure locales
步骤二:
- 注意这里的16是我postgres的版本,你要改成你对应的版本数字比如14就改成14,然后出现语言区域我一般默认直接回车
pg_createcluster 16 main --start
步骤三:
/etc/init.d/postgresql start
然后就成功了
sudo su - postgres
psql
引用来自
https://askubuntu.***/questions/50621/can-not-connect-to-postgresql-listening-on-port-5432