Postgresql -bash: psql: command not found

后端 未结 6 2143
借酒劲吻你
借酒劲吻你 2020-12-13 17:39

I have installed PostgreSQL and it is working ok. However, when I went to restore a backup I got the error -bash: psql: command not found:

 [roo         


        
6条回答
  •  佛祖请我去吃肉
    2020-12-13 18:07

    In case you are running it on Fedora or CentOS, this is what worked for me (PostgreSQL 9.6):

    In terminal:

    $ sudo visudo -f /etc/sudoers
    

    modify the following text from:

    Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin
    

    to

    Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.6/bin
    

    exit, then:

    $ printenv PATH
    
    $ sudo su postgres
    
    $ psql
    

    To exit postgreSQL terminal, you need to digit:

    $ \q
    

    Source: https://serverfault.com/questions/541847/why-doesnt-sudo-know-where-psql-is#comment623883_541880

提交回复
热议问题