ubuntu@i-qo8hlriu:/opt/pgsql$ pg_ctl stop
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.
報錯
加入PGDATA環境變量
ubuntu@i-qo8hlriu:/opt/pgsql$ vi ~/.bash_profile
export PGDATA=/opt/pgsql/data
export PATH=$PATH:$PGDATA
ubuntu@i-qo8hlriu:/opt/pgsql$ pg_ctl
pg_ctl: no operation specified
Try "pg_ctl --help" for more information.
ubuntu@i-qo8hlriu:/opt/pgsql$ pg_ctl restart
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.
重啓配置
ubuntu@i-qo8hlriu:/opt/pgsql$ . ~/.bash_profile
ubuntu@i-qo8hlriu:/opt/pgsql$ pg_ctl restart
waiting for server to shut down.... done
server stopped
waiting for server to start....2020-05-20 15:37:07.562 CST [8264] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-05-20 15:37:07.583 CST [8264] LOG: listening on IPv6 address "::", port 5432
2020-05-20 15:37:07.602 CST [8264] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-05-20 15:37:07.671 CST [8265] LOG: database system was shut down at 2020-05-20 15:37:07 CST
2020-05-20 15:37:07.685 CST [8264] LOG: database system is ready to accept connections
done
server started