Create a user who can create databases
[ryan@localhost]$ su Password: [root@localhost]# su postgres
(Or "sudo -s -u postgres" on Ubuntu, entering your password when asked)
Now use createuser to create a user that may access the postgres server:
$ createuser -P (-P means "assign password") Enter name of role to add: ryan Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) y CREATE ROLE
Allowing access
By default, Postgres usually only allows connections from the same computer, and not via the TCP/IP connection method that Glom uses. You need to change this like so:
postgresql.conf
As root, edit
/etc/postgresql/9.1/main/postgresql.conf
(In Ubuntu, using sudo. Use 8.1, 8.4, or similar, instead of 9.1, depending on your Ubuntu version.) or
/var/lib/pgsql/data/postgresql.conf
(In Fedora)
Add this line, replacing (or commenting-out) any previous settings for listen_addresses
listen_addresses = '*'
The default, which is also often on a commented-out line, when you don't set listen_addresses, is
listen_addresses = 'localhost'
but this does not allow connections from other computers.
pg_hba.conf
As root, edit
/etc/postgresql/9.1/main/pg_hba.conf
(In Ubuntu, using sudo. Use 8.1, 8.4, or similar, instead of 9.1, depending on your Ubuntu version.) or
/var/lib/pgsql/data/pg_hba.conf
(on Fedora)
Add this host line, before any other uncommented host lines:
#Allow any IP to connect, with a password: host all all 0.0.0.0 0.0.0.0 md5 host all all ::1/128 md5 local all all md5
(I think the gaps can be either tabs or spaces.)
(Apparently all three lines are necessary, at least with PostgreSQL 9.1, but please tell me (Murray) if you know better.)
Now, restart the Postgres server. The easiest way to do this is to restart your computer.
service postgresql restart
Klik tombol colokan kabel lalu isikan user dan passwornya nya sesui dengan yang dibuat diatas selebihnya sesui dengan screenshot dibawah ini.
Comments