WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Postgresql  (Read 3810 times)

Offline manchuwook

  • Newbie
  • *
  • Posts: 13
Postgresql
« on: July 25, 2011, 02:18:20 PM »
pg_hba.conf
local all all  trust
host all all 192.168.0.0/24 md5

postgresql.conf
port=<default>
listen=*

1473 tc /tmp/tcloop/postgresql/usr/local/bin/postgres -D /mnt/sdb1/postgres <-- exists
1479 tc postgres: writer process
1480 tc postgres: wal writer process
1481 tc postgres: autovacuum launcher process
1482 tc postgres: stats collector process

createuser: could not connect to database postgres: FATAL: role "tc" does not exist
...
createuser: could not connect to database postgres: FATAL: role "root" does not exist
...
createuser: could not connect to database postgres: FATAL: role "postgre" does not exist
...
createuser: could not connect to database postgres: FATAL: role "postgres" does not exist
...
createuser: could not connect to database postgres: FATAL: role "postgresql" does not exist
...
createuser: could not connect to database postgres: FATAL: role "pgsql" does not exist
...
createuser: could not connect to database postgres: FATAL: role "pg" does not exist

Why no createuser?

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Postgresql
« Reply #1 on: July 25, 2011, 09:19:46 PM »
I'm not sure what might be different at your end, but (taking into account the information you've provided about your config files) I've just tried to repeat your test (using a "plain" TC 3.7.1 system freshly started from CD-ROM):
Code: [Select]
tc@box:~$ tce-load -wi postgresql > /dev/null 2>&1
tc@box:~$ export PGDATA=/tmp/test_pg
tc@box:~$ pg_ctl init
The files belonging to this database system will be owned by user "tc".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

creating directory /tmp/test_pg ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 28MB
creating configuration files ... ok
creating template1 database in /tmp/test_pg/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the next time you run initdb.

Success. You can now start the database server using:

    /tmp/tcloop/postgresql/usr/local/bin/postgres -D /tmp/test_pg
or
    /tmp/tcloop/postgresql/usr/local/bin/pg_ctl -D /tmp/test_pg -l logfile start


tc@box:~$ printf "local all all trust\nhost all all 192.168.0.0/24 md5\n" > ${PGDATA}/pg_hba.conf
tc@box:~$ printf "port=5432\nlisten_addresses='*'\n" > ${PGDATA}/postgresql.conf
tc@box:~$ pg_ctl start
server starting
tc@box:~$ LOG:  could not create IPv6 socket: Address family not supported by protocol
LOG:  database system was shut down at 2011-07-26 01:02:33 UTC
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

tc@box:~$ createdb
tc@box:~$ psql
psql (9.0.4)
Type "help" for help.

tc=# \dn
      List of schemas
        Name        | Owner
--------------------+-------
 information_schema | tc
 pg_catalog         | tc
 pg_toast           | tc
 pg_toast_temp_1    | tc
 public             | tc
(5 rows)

tc=# \q
tc@box:~$
tc@box:~$ head ${PGDATA}/pg_hba.conf ${PGDATA}/postgresql.conf
==> /tmp/test_pg/pg_hba.conf <==
local all all trust
host all all 192.168.0.0/24 md5

==> /tmp/test_pg/postgresql.conf <==
port=5432
listen_addresses='*'
tc@box:~$

As you can see I was able to connect to the (empty) DB. Please note that I had to apply minor tweaks to '${PGDATA}/postgresql.conf', plus my PostgreSQL skills are now a bit rusty so I'm not sure whether these were all the right steps.

Maybe you could document your steps more precisely so that others are able to re-create the situation you are facing.