温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

postgresql Linux 二进制文件安装

发布时间:2020-08-10 16:14:12 来源:ITPUB博客 阅读:342 作者:18141908802 栏目:关系型数据库

一、创建psotgres用户

groupadd postgres

useradd -g postgres postgres



二、创建必须目录


下载路径https://www.enterprisedb.com/download-postgresql-binaries

wget https://get.enterprisedb.com/postgresql/postgresql-9.6.4-1-linux-x64-binaries.tar.gz


进入下载目录

tar -xzf postgresql-9.6.4-1-linux-x64-binaries.tar.gz -C /data/service



创建data目录:

mkdir -p /data/service/postgresql/data

mkdir -p /data/service/postgresql/log



授权:

chown -R postgres.postgres pgsql  (解压目录)

chown -R postgres.postgres postgresql



三、初始化



cd /data/service/pgsql/

su postgres



./bin/initdb -E utf8 -D /data/service/postgresql/data



四、启动

./postgres -D /data/service/postgresql/data/ > /data/service/postgresql/log/postgres.log &

 

 关闭

./pg_ctl -D /data/service/postgresql/data stop 

 

 

登录 

./psql -U pg -d mydb



----------------------

远程连接

1 修改pg_hba.conf文件

host  all    all    127.0.0.1/32     trust

host  all    all    192.168.1.0/24    md5



其中,数字24是子网掩码,表示允许192.168.1.0--192.168.1.255的计算机访问!



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI