加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgreSQL二进制快速安装

发布时间:2020-12-13 16:48:09 所属栏目:百科 来源:网络整理
导读:二进制安装步骤: groupadd postgres useradd -g postgres postgres id postgres passwd postgres mkdir -p /data/postgresql/data mkdir -p /data/postgresql/log tar xf postgresql-9.5.9-1-linux-x64-binaries.tar.gz -C /usr/local/ cd /usr/local/ chow

二进制安装步骤:

groupadd postgres

useradd -g postgres postgres

id postgres

passwd postgres

mkdir -p /data/postgresql/data

mkdir -p /data/postgresql/log

tar xf postgresql-9.5.9-1-linux-x64-binaries.tar.gz -C /usr/local/

cd /usr/local/

chown -R postgres.postgres pgsql

cd /data

chown -R postgres.postgres postgresql

cd /usr/local/pgsql/bin/

vim /etc/profile

source /etc/profile


普通用户启动postgreSQL服务

su - postgres

初始化数据库:

initdb -E utf8 -D /data/postgresql/data

启动数据库:

pg_ctl -D /data/postgresql/data -l /data/postgresql/log/postgres.log start

[root@localhost log]# tailf /data/postgresql/log/postgres.log

LOG: could not create IPv6 socket: Address family not supported by protocol

LOG: database system was shut down at 2017-10-04 18:06:18 CST

LOG: MultiXact member wraparound protections are now enabled

LOG: database system is ready to accept connections

LOG: autovacuum launcher started

关闭postgresql服务

pg_ctl -D /data/postgresql/data -l /data/postgresql/log/postgres.log stop

[root@localhost log]# tailf /data/postgresql/log/postgres.log

LOG: received fast shutdown request

LOG: aborting any active transactions

LOG: autovacuum launcher shutting down

LOG: shutting down

LOG: database system is shut down

重启postgresql服务

pg_ctl -D /data/postgresql/data -l /data/postgresql/log/postgres.log restart

[root@localhost log]# tailf /data/postgresql/log/postgres.log

LOG: received fast shutdown request

LOG: aborting any active transactions

LOG: autovacuum launcher shutting down

LOG: autovacuum launcher shutting down

LOG: shutting down

LOG: database system is shut down

LOG: could not create IPv6 socket: Address family not supported by protocol

LOG: database system was shut down at 2017-10-04 18:08:15 CST

LOG: MultiXact member wraparound protections are now enabled

LOG: database system is ready to accept connections

LOG: autovacuum launcher started

查看启动日志:

tail -100f /data/postgresql/log/postgres.log

ps -ef

登陆数据库:

psql

默认登陆postgresql数据库是不需要密码的

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读