Postgresql 安装、备份、还原
./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
export LANG=zh_CN.UTF8
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data -E UTF8
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb than
/usr/local/pgsql/bin/psql test
# ./pg_ctl -D /usr/local/pgsql/data start (启动)
# ./pg_ctl -D /usr/local/pgsql/data stop(关闭)
接下来,就是安装配置 windowns版的管理工具:pgAdmin III
由于postgresql默认没有开启监听端口,下面需要在服务器端做一些设置:
修改postgresql数据库配置文件
$ vi /usr/local/pgsql/data/postgresql.conf
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
# Note: increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directory = '' # (change requires restart)
unix_socket_group = '' # (change requires restart)
unix_socket_permissions = 0777 # octal
# (change requires restart)
#bonjour_name = '' # defaults to the computer name
修改客户端配置文件
$ vi /usr/local/pgsql/data/pg_hba.conf
# "local" is for Unix domain socket connections only
local all all trust
#IPv4 local connections:
host all all 192.168.1.0/24 trust
下面下载pgAdmin III 安装,连接就可以很方便的管理了,
alter user postgres password '6220104'; //设置postgres用户密码
CREATE SCHEMA tank AUTHORIZATION tank; //指定tank用户下的默认schema为tank
阅读(2442) | 评论(0) | 转发(0) |