在树莓派pi b + Stretch Lite上移动数据目录后,Psql无法连接到服务器

时间:2019-01-26 18:04:00

标签: postgresql raspberry-pi

我在树莓派上安装了一个外部ntfs硬盘。我安装了postgresql 9.6并运行了命令:

sudo su postgres
psql

一切正常。然后,我停止了postgres服务,并运行以下命令将数据目录复制到我的外部硬盘驱动器上:

sudo rsync -av /var/lib/postgresql /mnt/usbhdd

接下来,我编辑了conf文件并更改了数据目录位置:

sudo nano /etc/postgresql/9.6/main/postgresql.conf
data_directory = '/mnt/usbhdd/postgresql/9.6/main'

然后我重新启动了postgres服务,但是现在当我运行这些命令时:

sudo su postgres
psql

我收到此错误:

psql: 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"?

有什么想法会导致这种情况吗?可能是由于我的nfts USB硬盘上的权限引起的吗?

0 个答案:

没有答案
相关问题