linux 重启pgsql 失败,添加PGDATA环境变量

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

 

你可能感兴趣的:(ubuntu)