Psql Command Not Found Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
Psql Command Not Found Mac
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs psql not found linux Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, psql command not found ubuntu just like you, helping each other. Join them; it only takes a minute: Sign up Postgresql -bash: psql: command not found up vote 15 down vote favorite 3 I have installed PostgreSQL and it is working ok.
Psql Command Not Found Centos
However, when I went to restore a backup I got the error -bash: psql: command not found: [root@server1 ~]# su postgres [postgres@server1 root]$ psql -f all.sql bash: psql: command not found [postgres@server1 root]$ What have I done wrong? linux postgresql psql share|improve this question edited Jul 31 '12 at 5:28 Erwin Brandstetter 220k29358468 asked Jul 22 '11 at 12:33 Peter 115139 2 This can happen on CentOS when you accidentally install PostgreSQL 8.4
Psql Command Not Found Windows
(package postgresql-server) after installing PostgreSQL 9.2 (package postgresql-server92) on the same machine. If you erase PostgreSQL 8.4, yum also removes the postgres bin directory from the path. –Iain Elder Sep 24 '13 at 11:15 ^^ THIS! Thanks Iain –Joe Czucha Nov 27 '14 at 15:06 add a comment| 3 Answers 3 active oldest votes up vote 10 down vote accepted perhaps psql isn't in the PATH of the postgres user. Use the locate command to find where psql is and ensure that it's path is in the PATH for the postgres user. share|improve this answer answered Jul 22 '11 at 12:37 marto 3,0741314 add a comment| up vote 18 down vote export PATH=/usr/pgsql-9.2/bin:$PATH The program executable psql is in the directory /usr/pgsql-9.2/bin, and that directory is not included in the path by default, so we have to tell our shell (terminal) program where to find psql. When most packages are installed, they are added to an existing path, such as /usr/local/bin, but not this program. So we have to add the program's path to the shell PATH variable if we do not want to have to type the complete path to the program every time we execute it. This line should typically be added to theshell startup script, which for the bash shell will be in the f
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the bash psql command not found centos workings and policies of this site About Us Learn more about Stack
Postgresql-setup Command Not Found Centos
Overflow the company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags locate psql Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how http://stackoverflow.com/questions/6790088/postgresql-bash-psql-command-not-found it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Why doesn't sudo know where psql is? up vote 3 down vote favorite 1 The problem The CKAN installation documentation shows you how to list the installed PostgreSQL databases. The command looks like this: sudo -u postgres psql -l http://serverfault.com/questions/541847/why-doesnt-sudo-know-where-psql-is When I try that in my shell, I get an error: $ sudo -u postgres psql -l sudo: psql: command not found The workaround Daniel2d2art on the CentOS forum worked around the problem by fully qualifying the path to psql. My psql lives in the directory /usr/pgsql-9.2/bin, so my workaround now looks like this: sudo -u postgres /usr/pgsql-9.2/bin/psql -l When I try that in my shell, it works: $ sudo -u postgres /usr/pgsql-9.2/bin/psql -l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------+----------+----------+-------------+-------------+----------------------- postgis_test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) How do I fix it properly? I shouldn't have to fully qualify the path, right? The postgres user already has psql in its path: $ sudo -u postgres echo $PATH /usr/pgsql-9.2/bin:/usr
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more http://dba.stackexchange.com/questions/3005/how-to-run-psql-on-mac-os-x about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask not found a question Anybody can answer The best answers are voted up and rise to the top How to run psql on Mac OS X? up vote 26 down vote favorite 9 I installed PostgreSQL on a computer with Mac OS X using the One click installer. Then I try to access PostgreSQL using the psql command, but it doesn't seem to be available. I get this message: psql -bash: psql: command not found command not found Do I have to install something more? Or how can I configure PostgreSQL so I can use it on my computer? postgresql installation psql mac-os-x share|improve this question asked May 28 '11 at 8:49 Jonas 6,817214055 add a comment| 3 Answers 3 active oldest votes up vote 25 down vote accepted Locate the psql binary. (In a terminal, run locate psql | grep /bin, and make note of the path. (In my case, it's /opt/local/lib/postgresql90/bin/, as it was installed using MacPorts.) Then, edit the .bash_profile file in your home folder (e.g. mate -w ~/.bash_profile assuming you've textmate), and add the needed line so it's in your path, e.g.: export PATH=/opt/local/lib/postgresql90/bin/:$PATH After having saved the file, read the file (. ~/.bash_profile) or open a new terminal, and type psql. share|improve this answer answered May 28 '11 at 14:54 Denis de Bernardy 819510 14 Thanks, my path to psql was /Library/PostgreSQL/9.0/bin/psql and I created a .bash_profile file as you suggested and it works great. –Jonas May 28 '11 at 17:18 1 @Jonas: +1 Your comment should really go into a separate answer and should be the accepted answer, because this is the default location when installing Postgres on a Mac! –Stefan Haberl Nov