简体   繁体   English

如何在Ubuntu 13.04上的Postgresql中更改数据目录

[英]How to change the Data directory in Postgresql on Ubuntu 13.04

I am having a problem changing the data directory on postgresql 9.1 on ubuntu 13.04: 我在ubuntu 13.04上的postgresql 9.1上更改数据目录时遇到问题:

I first did a: 我首先做了一个:

sudo pg_dropcluster --stop 9.1 main

and then attempted to create a new one in the desired path: 然后尝试在所需路径中创建一个新的:

 sudo pg_createcluster -d /home/fccoelho/Documentos/databases/postgresqldata 9.1 main

but i fails with a permission denied: 但是我失败,但拒绝了权限:

Creating new cluster (configuration: /etc/postgresql/9.1/main, data: /home/fccoelho/Documentos/databases/postgresqldata/)...
initdb: could not access directory "/home/fccoelho/Documentos/databases/postgresqldata": Permission denied
Error: initdb failed

I should mention That I checked the permissions, tried creating the directory manually and "chowning" to user postgres afterwards, etc. nothing changed the permission denied message. 我应该提到我检查了权限,尝试手动创建目录,然后向用户postgres“扔”,等等。什么都没有改变权限被拒绝的消息。

I also tried to used the initdb binary distributed with POstgresql without success 我也尝试使用随POstgresql分发的initdb二进制文件而没有成功

How do I make this work? 我该如何工作?

I have found a workaraound, but not really a solution: 我找到了一种工作方法,但不是真正的解决方案:

I found out I cannot maintain the data directory within my home tree so I created a new directory /home/postgresqldata/ and ran: 我发现我无法在主目录树中维护数据目录,因此我创建了一个新目录/ home / postgresqldata /并运行:

sudo pg_createcluster -d /home/postgresqldata/ 9.1 main

and everything worked as expected!! 一切都按预期工作!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM