Ярлыки

Показаны сообщения с ярлыком PostgreSQL. Показать все сообщения
Показаны сообщения с ярлыком PostgreSQL. Показать все сообщения

суббота, 3 ноября 2012 г.

Django: django-admin - user was not authenticated


Problem: //localhost:8000/admin => error "user was not authenticated".
Solve: in postgreSQL - add this user as superuser; restart DB.

Error while installing PostgreSQL


While installing PostreSQL I have follow start DB-server error:
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
(errors: LOG:  could not bind IPv4 socket: address alredy in use
HINT:  Is another postmaster already running on port 5432? If not,
wait a few seconds and retry.)

I stop already starting db:
etc/init.d/postresql stop
And all is OK.

There is small test for correct work of PostgreSQL:
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

Some steps for settings PostgreSQL


There are few steps for setting PostgreSQL:
0) pg_config --version
 - what version are installed?
1) pg_config --configure
  - see server configuration
2) sudo useradd postgres
 - command for add user
3) Make DB dir and delegate permissions to new user:
    mkdir /usr/local/pgsql/data
    chown postgres /usr/local/pgsql/data
4) starting DB:
    $ sudo - postgres
    pg$
5) Inizialize DB:
    pg$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
6) Starting DB again:
    /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
or 
   /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
7) permissions for remote host (not localhost) - in file /usr/local/pgsql/data/pg_hba.conf
in format: host - DB name - user - IP-address - mask - authentication (md5/trust)
  We must also write variable `listen_adresses="*"` in file postgresql.conf
8) start, stop and restart DB:
    pg_ctl start
    pg_ctl_stop
    pg_ctl_restart
9) test: connect to template "template1":
    psql -h 192.168.0.111 -d template1
10) reboot server
11) Then we must see for starting postmaster:
    ps -el | grep post
12) create DB:
    create_db ******
13) create user:
    CREATE USER myuser WITH password 'mypsw';