时间:2021-07-01 10:21:17 帮助过:126人阅读
2.创建用户并设置密码
useradd postgres && passwd postgres
3.创建postgres的数据目录并授权
mkdir -p /opt/postgres/pg_data && chown -R postgres:postgres /opt/postgres/pg_data
4.切换到postgres用户启动数据库,并初始化数据库
su - postgres && /opt/postgres/pgsql/bin/initdb -D /opt/postgres/pg_data/
5.启动数据库
/opt/postgres/pgsql/bin/pg_ctl -D /opt/postgres/pg_data/ -l logfile start
[postgres@linux-node1 ~]$ netstat -lnupt|grep 5432
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:5432 0.0.0.0: LISTEN 23546/postgres
tcp6 0 0 ::1:5432 ::: LISTEN 23546/postgres
6.登录数据库
[postgres@linux-node1 pgsql]$ ./bin/psql -h localhost -d postgres -U postgres -p 5432
\l 查看数据库列表 \q退出交互界面
7.停止数据库
/opt/postgres/pgsql/bin/pg_ctl -D /opt/postgres/pg_data/ stop
postgresql-10.12安装和部署
标签:inux processes follow x64 ini amp erp 列表 tcp