freebsd上postgre安装

freebsd上postgre安装

cd /usr/ports/databases/postgresql84-server/
sudo make install clean

sudo emacs /etc/login.conf
---
postgres:\
        :lang=en_US.UTF-8:\
        :setenv=LC_COLLATE=C:\
        :tc=default:
---
and run `cap_mkdb /etc/login.conf'.
Then add 'postgresql_class="postgres"' to /etc/rc.conf.

To initialize the database, run

  sudo /usr/local/etc/rc.d/postgresql initdb

You can then start PostgreSQL by running:

  sudo /usr/local/etc/rc.d/postgresql start
To run PostgreSQL at startup, add
'postgresql_enable="YES"' to /etc/rc.conf

监听所有地址

sudo emacs /usr/local/pgsql/data/postgresql.conf
listen_addresses = '*'

允许某ip段连接

sudo emacs /usr/local/pgsql/data/pg_hba.conf
# my lan
host    all         all         192.168.64.0/22       md5

修改pgsql密码

su
su pgsql
psql -d postgres
alter user pgsql with password '******';

给某个db增加过程语言

createlang plpgsql yangchao

你可能感兴趣的:(freebsd上postgre安装)