Обсуждение: Connecting and creating db

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

Connecting and creating db

От
"Sandy Keathley"
Дата:
Well, this is a novice list, so I hope no one will find me too pitiful to answer.

Although I have used Postgres before, some years ago, I had never installed it (maybe I still
haven't).  I have installed version 9.0 by RPM, on an RHEL 4 box.  I can start the server,
but there are two problems:

1. logged in as user "postgres", I cannot connect to the database server without first issuing
(every time) the command: export LD_LIBRARY_PATH="/usr/pgsql/lib"
This is annoying.

2.  once connected to the cluster, I cannot create a database.  There is no error message,
and nothing is logged.  I am using the command "createdb graves". Nothing happens.

\l displays the databases (postgres, template0, template1).

Can someone point me in the right direction?

Thanks,

Sandy Keathley



Re: Connecting and creating db

От
Tom Lane
Дата:
"Sandy Keathley" <sandy@keathleywebs.com> writes:
> Although I have used Postgres before, some years ago, I had never installed it (maybe I still
> haven't).  I have installed version 9.0 by RPM, on an RHEL 4 box.  I can start the server,
> but there are two problems:

Whose RPM exactly?

> 1. logged in as user "postgres", I cannot connect to the database server without first issuing
> (every time) the command: export LD_LIBRARY_PATH="/usr/pgsql/lib"
> This is annoying.

Sounds like the RPM author neglected to see to updating the ldconfig
data.  If the RPM stuck a file in /etc/ld.so.conf.d pointing to
/usr/pgsql/lib, you should just be able to run /sbin/ldconfig (as root)
and be good --- otherwise consider doing that manually.

> 2.  once connected to the cluster, I cannot create a database.  There is no error message,
> and nothing is logged.  I am using the command "createdb graves". Nothing happens.

I wonder whether you're typing a shell command at the SQL prompt?
If so, the first problem is you didn't terminate the command with
a semicolon, and the second is that in SQL you'd have to say
"create database graves;" --- createdb is a shortcut for doing this
from a shell prompt, not something you can use within SQL.

            regards, tom lane

Re: Connecting and creating db

От
"Sandy Keathley"
Дата:
Thank you very much.  That fixed everything.


> > Although I have used Postgres before, some years ago, I had never
> > installed it (maybe I still haven't).  I have installed version 9.0
> > by RPM, on an RHEL 4 box.  I can start the server, but there are two
> > problems:
>
> Whose RPM exactly?

Got it from Postgresql.

>
> > 1. logged in as user "postgres", I cannot connect to the database
> > server without first issuing (every time) the command: export
> > LD_LIBRARY_PATH="/usr/pgsql/lib" This is annoying.
>
> Sounds like the RPM author neglected to see to updating the ldconfig
> data.  If the RPM stuck a file in /etc/ld.so.conf.d pointing to
> /usr/pgsql/lib, you should just be able to run /sbin/ldconfig (as
> root) and be good --- otherwise consider doing that manually.

My fault. I removed a previous version, so to keep compatibility, I changed filenames
containing postgres-9.0 to just postgres, but missed a reference in ld.so.conf.d


>
> > 2.  once connected to the cluster, I cannot create a database.
> > There is no error message, and nothing is logged.  I am using the
> > command "createdb graves". Nothing happens.
>
> I wonder whether you're typing a shell command at the SQL prompt? If
> so, the first problem is you didn't terminate the command with a
> semicolon, and the second is that in SQL you'd have to say "create
> database graves;" --- createdb is a shortcut for doing this from a
> shell prompt, not something you can use within SQL.

I inferred from the docs that "createdb" was an alias for "create database", so I was using it
in a SQL context.  Thanks for clearing that up for me.

Thanks again.

Sandy Keathley



Re: Connecting and creating db

От
Michael Wood
Дата:
On 21 April 2011 02:43, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Sandy Keathley" <sandy@keathleywebs.com> writes:
[...]
>> 1. logged in as user "postgres", I cannot connect to the database server without first issuing
>> (every time) the command: export LD_LIBRARY_PATH="/usr/pgsql/lib"
>> This is annoying.
>
> Sounds like the RPM author neglected to see to updating the ldconfig
> data.  If the RPM stuck a file in /etc/ld.so.conf.d pointing to
> /usr/pgsql/lib, you should just be able to run /sbin/ldconfig (as root)
> and be good --- otherwise consider doing that manually.
[...]

Did RHEL 4 support /etc/ld.so.conf.d?  He might need to put it in
/etc/ld.so.conf.

Sandy, if there's no /etc/ld.so.conf.d directory on the machine, just
add /usr/pgsql/lib to /etc/ld.so.conf and then run /sbin/ldconfig as
mentioned by Tom.

--
Michael Wood <esiotrot@gmail.com>