After installing
PostgreSQL with
Kubuntu package manager, hope was that knowing the name of the database client program, the journey could start. But:
taimo@deficiency:~$ psql
psql: FATAL: Ident authentication failed for user "taimo"
taimo@deficiency:~$ psql --help
This is psql 8.3.7, the PostgreSQL interactive terminal.
Usage:
psql [OPTIONS]... [DBNAME [USERNAME]]
General options:
-d DBNAME specify database name to connect to (default: "taimo")
-c COMMAND run only single command (SQL or internal) and exit
-f FILENAME execute commands from file, then exit
-1 ("one") execute command file as a single transaction
-l list available databases, then exit
Heh. Database might just not exist. Will see.
taimo@deficiency:~$ psql -l
psql: FATAL: Ident authentication failed for user "taimo"
Hmm. Maybe this
ident authentication thingy is all wrong?
taimo@deficiency:~$ ls /etc/postgresql/8.3/main/
environment pg_hba.conf pg_ident.conf postgresql.conf start.conf
That
pg_ident.conf looked suspicious, but turned out to be empty, only noting that if ident user names coincide with
PostgreSQL user names, this file is not needed. Instead special mapping
'sameuser' should be used in
pg_hba.conf. And that file indeed seems to have the mapping. So what is wrong?
taimo@deficiency:~$ ls /usr/share/doc/postgresql-8.3/
changelog.Debian.gz changelog.gz copyright README README.Debian.gz
Ah. The Debian README has instructions for actually creating the database with createdb command. So the database is not even there yet!
taimo@deficiency:~$ man createdb
Normally, the database user who executes this command becomes the owner of the new database.
taimo@deficiency:~$ createdb
createdb: could not connect to database postgres: FATAL: Ident authentication failed for user "taimo"
Ah. Misread the instructions. First switch to
postgres had to be done, then the
PostgreSQL user with desired name and rights created, including database creation rights.
taimo@deficiency:~$ sudo -u postgres sh
[sudo] password for taimo:
$ createuser -drS taimo
$ exit
taimo@deficiency:~$ createdb
taimo@deficiency:~$ psql
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
Yay! Seamless ident auth after creating the db user.
No comments:
Post a Comment