远程访问
postgresql.conf
listen_addresses = '*'
port = 5432
pg_hba.conf
host all all 0.0.0.0/0 md5
命令行
su postgres -c psql
创建用户
create user 'myuser' with password 'mypass' createdb;
重设密码
\password 'myuser'
导出sql
pg_dump --host localhost --port 15432 --username myuser-d mydb> mydb.sql
导入
mv mydb.sql /tmp/mydb.sql
psql# CREATE DATABASE mydb OWNER myuser;
psql# \c mydb
psql# \i /tmp/mydb.sql
service postgresql restart