遠(yuǎn)程訪問(wèn)
postgresql.conf
listen_addresses = '*'
port = 5432
pg_hba.conf
host all all 0.0.0.0/0 md5
命令行
su postgres -c psql
創(chuàng)建用戶
create user 'myuser' with password 'mypass' createdb;
重設(shè)密碼
\password 'myuser'
導(dǎo)出sql
pg_dump --host localhost --port 15432 --username myuser-d mydb> mydb.sql
導(dǎo)入
mv mydb.sql /tmp/mydb.sql
psql# CREATE DATABASE mydb OWNER myuser;
psql# \c mydb
psql# \i /tmp/mydb.sql
service postgresql restart