[配置]
1.postgresql 允许远程访问配置
声明:apt-get install 安装,配置文件应在/etc/postgresql/9.3/main //注: 9.3为postgresql版本号
1) postgresql.conf
#listen_addressed='localhost' --修改为-> listen_addressed='*' //注: “#”为注释语句,需要去掉
2)pg_hba.conf
找到 “# IPv4 local connections:” 的位置,在下面增加如下行:
host all all all md5 //注: 允许所有IP访问
host all all 192.168.1.10 md5 //注: 允许192.168.1.10访问
[命令]
1.修改用户密码
$ psql
postgres=# alter user [用户名] with password '[新密码]'; // 例: alter user postgres with pasword '123456';
2.导入数据库sql脚本
$ psql [数据库名] <
[文件路径]
// 例:psql testdb < /home/testdb.sql