From: | Thorsten Haude <postgresql(at)thorstenhau(dot)de> |
---|---|
To: | PostgreSQL Novice ML <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: create database, user |
Date: | 2002-03-10 20:04:45 |
Message-ID: | 20020310200445.GT808@eumel.yoo.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice pgsql-php |
Hi,
* Oliver Elphick <olly(at)lfix(dot)co(dot)uk> [02-03-10 19:58]:
>On Sun, 2002-03-10 at 18:23, Thorsten Haude wrote:
>> I want to create a database and a matching user for a web application.
>> I want to do all that from an SQL file but I have problems with both
>> 'create database' and 'create user'.
>>
>> - I have still not grasped how I should connect to the DBMS for things
>> like that; there is no root. Is there a document describing best
>> practices somewhere?
>
>It'll be in the docs somewhere; have you read the Administrator's Guide?
Not the whole thing, but anything I thought would be useful. Not
enough (thought) obviously.
>> - Are there any special provisions you have to follow to do create
>> database, user, tables and other object with one SQL file?
>Put all the commands into a text file, not forgetting the terminating
>semi-colons where they are needed.
I did that, and one of the problems was solved by \connect. It never
occured to me that you can use the backslash commands in a file.
The other problem is a password though. I changed one line in your
example to:
CREATE USER junk_user encrypted password 'secret';
And it fails:
ERROR: parser: parse error at or near "encrypted"
What's wrong here?
>Whether the above script succeeds in changing user depends on how
>pg_hba.conf is set up. If pg_hba.conf doesn't allow the connection, the
>script will fail at the \connect. You need the \connect, otherwise the
>table would be created in template1 rather than in the new database.
I checked, and it should work.
Thank you very much for your help!
Thorsten
--
The opposite of the above statement is also true.
From | Date | Subject | |
---|---|---|---|
Next Message | wim | 2002-03-11 11:12:27 | Slow performance... |
Previous Message | Josh Berkus | 2002-03-10 19:58:32 | Re: create database, user |
From | Date | Subject | |
---|---|---|---|
Next Message | Jules Alberts | 2002-03-13 09:11:56 | [newbie] simple browse / edit form in PHP |
Previous Message | Josh Berkus | 2002-03-10 19:58:32 | Re: create database, user |