Обсуждение: reatedb: database creation failed on mydb

Поиск
Список
Период
Сортировка

reatedb: database creation failed on mydb

От
taipan@shofiah.kusza.edu.my
Дата:

Hi!

I'm a new member and new to postgres.

beside postgrest user I would also want my student to create their own
database in their own home directory.

first I issue (under postgrest user)
    createuser user_id
then under that user_id I run
    initlocation ~/sql/data
then I run
    createdb -D ~/sql/data mydb

at this stage I get an error msg as below:
    ERROR:  Unable to create database directory ~/sql/data/base/mydb
    createdb: database creation failed on mydb.

what should I do now? I tried to find it in archives but i can't find it.
FYI I'm using postgres v 6.3 running under RedHat.

Thanks in advance.




Re: [GENERAL] reatedb: database creation failed on mydb

От
Herouth Maoz
Дата:
At 12:50 +0300 on 03/06/1999, taipan@shofiah.kusza.edu.my wrote:


> first I issue (under postgrest user)
>     createuser user_id
> then under that user_id I run
>     initlocation ~/sql/data
> then I run
>     createdb -D ~/sql/data mydb
>
> at this stage I get an error msg as below:
>     ERROR:  Unable to create database directory ~/sql/data/base/mydb
>     createdb: database creation failed on mydb.
>
> what should I do now? I tried to find it in archives but i can't find it.
> FYI I'm using postgres v 6.3 running under RedHat.

I think I know what the problem is. Remember that the one that creates the
database is the backend process. It basically creates a directory and
several files. It needs to be able to write in the location you specified.

Now, the backend process belongs to user postgres, whereas the directory in
which you want it to create the database belongs to the user user_id. So,
you have to give permission for writing to the postgres user in that
directory.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma