Re: How do I create a database if I can't connect to it?

From: "Paolo Victor" <paolovictor(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How do I create a database if I can't connect to it?
Date: 2007-07-27 17:54:45
Message-ID: f8c46d190707271054y3f7a6a56u53ebefbec2853025@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Success!

Here's what happened:

1. I should -not- use sudo to "make install", since my user already had the
required permissions. Using sudo messed up and caused those permission
errors.
2. As I mentioned before, I did install pg through the package system
before. The problem is: when I removed the package, all of pg's bin files
(createdb, initdb, etc) remained at /usr/bin , conflicting with the new ones
at /usr/local/pgsql/bin. After removing the dupe files...

paolo(at)box:~$ postgres -D /home/paolo/db -p 5435 -i
LOG: database system was shut down at 2007-07-27 14:47:19 BRT
LOG: checkpoint record is at 0/42C424
LOG: redo record is at 0/42C424; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 0/593; next OID: 10820
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system is ready

Terminal 2:
paolo(at)pira:~$ createdb nowItWorks -p 5435
CREATE DATABASE

:D

Once again thanks for the help and remember: Packaging systems may bite :o

Cheers,
Paolo

On 7/27/07, Paolo Victor <paolovictor(at)gmail(dot)com> wrote:
>
>
>
> On 7/27/07, Paolo Victor <paolovictor(at)gmail(dot)com> wrote:
> >
> > Ok, I found the problem: Permissions.
> >
> > Although I -do- have write/read/exec permission /usr/local/pgsql , some
> > files couldn't be copied after the install, probably rendering PG a bit
> > unstable =)
>
>
> Erm, I guess I mean "the config proccess failed" =)
>
> I tried installing PG in a folder in my home directory, and it worked like
> > a charm.
> >
> > Here's the output of the "sudo make install" command, when I tried
> > installing it at /usr/local/pgsql :
> >
> > /*
> > Actually, for the sake of the internet's tubes, I'll just post the
> > error (and last) lines.
> >
> > And for our non-portuguese-speaking friends:
> > Entrando no diretório = Entering Directory
> > Saindo do diretório = Leaving directory
> > */
> >
> > make[4]: Entrando no diretório `/home/paolo/Desktop/postgresql- 8.2.4
> > /src/interfaces/ecpg/include'
> > cd ../../../.. && ./config.status
> > src/interfaces/ecpg/include/ecpg_config.h
> > ./config.status: line 91: conf20566.sh: Permission denied
> > ./config.status: line 92: conf20566.sh : Permission denied
> > chmod: cannot access `conf20566.sh': No such file or directory
> > ./config.status: line 206: conf20566.file: Permission denied
> > sed: couldn't close stdout: Permission denied
> > cat: write error: Permission denied
> > mkdir: cannot create directory `./confstat20566-20898': Permission
> > denied
> > : cannot create a temporary directory in .
> > make[4]: ** [../../../../src/interfaces/ecpg/include/ecpg_config.h] Erro
> > 1
> > make[4]: Saindo do diretório `/home/paolo/Desktop/postgresql- 8.2.4
> > /src/interfaces/ecpg/include'
> > make[3]: ** [install] Erro 2
> > make[3]: Saindo do diretório `/home/paolo/Desktop/postgresql-8.2.4
> > /src/interfaces/ecpg'
> > make[2]: ** [install] Erro 2
> > make[2]: Saindo do diretório `/home/paolo/Desktop/postgresql- 8.2.4
> > /src/interfaces'
> > make[1]: ** [install] Erro 2
> > make[1]: Saindo do diretório `/home/paolo/Desktop/postgresql-8.2.4/src'
> > make: ** [install] Erro 2
> >
> > On 7/27/07, Paolo Victor <paolovictor(at)gmail(dot)com> wrote:
> > >
> > > First: Thanks for all the advice!
> > >
> > > David:
> > >
> > > I tried installing the system's packages, but as I plan using the
> > > python procedures feature, I've got to compile it with the "--with-python"
> > > option. I'm not sure if the default package already includes the feature,
> > > but since the createlang command failed and I found out on some forum
> > > (sorry, I lost the link) that I had to compile PG with this option set, I
> > > tried compiling PG myself.
> > >
> > > Oh, and I've already compiled PG before (but without the python
> > > option) and had no problems. I'm trying to compile the 8.2.4 version,
> > > I'll try with 8.2.3.
> > >
> > > Scott, Merlin:
> > >
> > > When I try to connect to one of the default databases, here's what I
> > > get:
> > >
> > > paolo(at)box:~$ psql -d template1 -p 5435
> > > NOTICE: table "pg_class" was reindexed
> > > NOTICE: table "sql_sizing" was reindexed
> > > NOTICE: table "sql_sizing_profiles" was reindexed
> > > NOTICE: table "sql_features" was reindexed
> > > NOTICE: table "sql_implementation_info" was reindexed
> > > NOTICE: table "sql_languages" was reindexed
> > > NOTICE: table "sql_packages" was reindexed
> > > NOTICE: table "sql_parts" was reindexed
> > > NOTICE: table "pg_statistic" was reindexed
> > > NOTICE: table "pg_type" was reindexed
> > > NOTICE: table "pg_attribute" was reindexed
> > > NOTICE: table "pg_proc" was reindexed
> > > NOTICE: table "pg_autovacuum" was reindexed
> > > NOTICE: table "pg_attrdef" was reindexed
> > > NOTICE: table "pg_constraint" was reindexed
> > > NOTICE: table "pg_inherits" was reindexed
> > > NOTICE: table "pg_index" was reindexed
> > > NOTICE: table "pg_operator" was reindexed
> > > NOTICE: table "pg_opclass" was reindexed
> > > NOTICE: table "pg_am" was reindexed
> > > NOTICE: table "pg_amop" was reindexed
> > > NOTICE: table "pg_amproc" was reindexed
> > > NOTICE: table "pg_language" was reindexed
> > > NOTICE: table "pg_largeobject" was reindexed
> > > NOTICE: table "pg_aggregate" was reindexed
> > > NOTICE: table "pg_rewrite" was reindexed
> > > NOTICE: table "pg_trigger" was reindexed
> > > NOTICE: table "pg_description" was reindexed
> > > NOTICE: table "pg_cast" was reindexed
> > > NOTICE: table "pg_namespace" was reindexed
> > > NOTICE: table "pg_conversion" was reindexed
> > > NOTICE: table "pg_depend" was reindexed
> > > REINDEX
> > >
> > > I get the same output when I execute the createuser command.
> > >
> > > On 7/27/07, Merlin Moncure <mmoncure(at)gmail(dot)com > wrote:
> > > >
> > > > On 7/27/07, David Fetter < david(at)fetter(dot)org > wrote:
> > > > > On Fri, Jul 27, 2007 at 11:28:58AM -0300, Paolo Victor wrote:
> > > > > > Hello,
> > > > > >
> > > > > > For a short description, I'll just show the sequence of commands
> > > > I'm trying
> > > > > > to execute:
> > > > > >
> > > > > > paolo(at)box> initdb -D /usr/local/pgsql/data/
> > > > >
> > > > > This looks like a mistake. Unless you plan to develop the
> > > > PostgreSQL
> > > > > code itself, you should not be installing from source. Instead,
> > > > you
> > > > > should be using one from the packaging system your operating
> > > > system
> > > > > uses.
> > > >
> > > > I don't necessarily agree with this advice. I encourage everyone
> > > > who
> > > > is considering serious development with PostgreSQL to become
> > > > familiar
> > > > with the database architecture...there are advantages to compiling
> > > > from source yourself if you know what you are doing, and simply
> > > > learning how to do it is a good exercise.
> > > >
> > > > I am also very suspicious of the assertion that knowledge of how to
> > > > manually invoke initdb is not necessary. While the binary vs source
> > > > argument certainly debatable, I would certainly advise every
> > > > PostgreSQL dba to memorize the initdb man page for various reasons.
> > > > However, there are few reasons to run postgres directly, we normally
> > > >
> > > > rely on pg_ctl for that (but it's still useful to know it can be
> > > > done).
> > > >
> > > > anyways, to the OP, you need to connect to one of the default
> > > > databases (postgres, or template1) and create one from there...or
> > > > invoke the createdb command.
> > > >
> > > > merlin
> > > >
> > >
> > >
> >
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stuart 2007-07-27 18:22:04 ascii() for utf8
Previous Message Paolo Victor 2007-07-27 17:39:46 Re: How do I create a database if I can't connect to it?