linux使用yum安装postgresql9.2
·
安装postgresql postgresql-server
yum install -y postgresql postgresql-server
查看安装结果。
rpm -qa | grep postgresql
初始化
service postgresql initdb
命令
启动:systemctl start postgresql
重启:systemctl restart postgresql
停止:systemctl stop postgresql
状态:systemctl status postgresql
开放端口(如果防火墙已经关闭则可以省略)
iptables -I INPUT -p tcp --dport 5432 -j ACCEPT
验证安装结果,首先输入 su - postgres切换用户,然后输入psql,出现版本号,则安装成功,可以顺便修改密码:
alter user postgres with password '密码';
修改配置实现远程连接
vi /var/lib/pgsql/data/postgresql.conf
修改listen_addresses="*"
vi /var/lib/pgsql/data/pg_hba.conf
# IPv4 local connections:
每个机器都能远程连接
host all all 0.0.0.0/0 md5
重启,连接测试,用户名默认是postgres,密码是刚才修改的
更多推荐
所有评论(0)