English 中文(简体)
Dgresql 弃置许可
原标题:Postgresql dump permission denied
  • 时间:2012-01-12 13:27:39
  •  标签:
  • postgresql

我在试图丢弃数据库时发现这一错误,即输入。

linuxuser $ sudo su postgres
linuxuser $ [sudo] password for linuxuser:...
$ pg_dump -h localhost mydb >tempfile
$ sh: cannot create tempfile: Permission denied

问题是什么? i 刚安装了新鲜电.。

最佳回答

书写邮资用户可读书的名录。 例如/tmp

$ pg_dump -h localhost mydb >/tmp/tempfile

在您的尝试中,用户试图在属于其他用户的一些随机名录中建立一个档案。

问题回答

任何了解邮政超级用户密码的未设名用户可以通过更改对工作名录的许可来提供反馈和恢复:

% mkdir backup

% chmod 0777 backup

% su postgres

[enter password]

$ cd backup

$ pg_dump mydb >tempfile

$ exit

“雇员档案”将由邮资拥有,与用户相同。

sudo su postgres doesn t change the current directory so you re still in linuxuser s home directory and postgres has no permission to write into it. Change to a different directory

postgres User

正如其他正确的答复所述,你试图挽救背书的夹没有被分配到<代码>postgres用户(操作系统用户账户)上。 <代码>postgres的用户是运行备份的用户。 该用户账户是在邮政安装过程中设立的。 您可能使用不同的名称,但缺省为postgres

Folder With Permissions

解决办法是,在postgres的用户有读标准许可的情况下,找到或创建倍

Mac OS X

在Maceau X(Mountain狮子)中,我能够在Finder中设立这样的一倍。

  1. In the Finder, create a new folder. Select it.
    In this example, I created a folder named postgres_backups.
  2. Choose File > Get Info.
  3. Open the disclosure triangle for the Sharing & Permissions section.
  4. Click the Plus button to add another item to the list of users.
    A list of users appears in a "sheet" dialog.
  5. Select the postgres user from the list.
  6. In the Privilege column, for the new postgres row, change the popup menu to Read & Write.
  7. Close the Get Info window. Done.

现在你可以指导你的工作。 寄回文件。

“屏幕上射“Getinfo"Finder窗口”/</p

By the way, I use the pgAdmin app to do backups and restores. Control+click on the desired database and choose Backups…. The pgAdmin app was probably bundled with your Postgres installation.

首先,你必须做的是不要转而使用员额。 利用这一指挥进行后备:

pg_dump -U username -h localhost dbname > /db.sql

就我而言,我必须写上一个完整的档案名称,如垃圾场5。





相关问题
摘录数据

我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。

Postgres dump of only parts of tables for a dev snapshot

On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...

How to join attributes in sql select statement?

I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.

What text encoding to use?

I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...

SQL LIKE condition to check for integer?

I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...

热门标签