1

I started working with PostgreSQL and till now I only had issues with it ( pgAdmin3 issues the most ) now I work a lot with MySQL and sometimes on the command line by just doing

mysql -u ... -h localhost -p for example and I'm connected through the command line.

Is there also a way to connect to the PostgreSQL database without pgAdmin and run it through the command line (Terminal) (I am working on OS X Mountain Lion).

p.s. I am also not a real big fan of letting PostgreSQL create a user. It annoys me when I start up my Mac and see PostgreSQL as user in the login screen. Is it possible to avoid that?

6

The PostgreSQL command line client is called psql. You can do pretty much everything with it (apart from taking dumps, for example), you'd better reading its documentation. Try running locate psql in a terminal and you will find its binary.

As far as I know, on OS X (and typically on other systems, too) pgAdmin is bundled with the server package, so you won't be able to install PostgreSQL without it. Here I am not very well informed, so handle this with care.

Regarding the postgres user, on linux machines it is a must to have it (and again, it looks the same on all other systems, too), you simply cannot run the server with other users. If you don't use PostgreSQL, the user will sit there quietly, won't eat your food and drink your beer, so you need not to worry about it.

0

For pgadmin4 for mac, you can find the location of psql binary.

sudo find / -name psql

In my case, I find it at:

/Applications/pgAdmin\ 4.app/Contents/SharedSupport/

Then you can build symbolic link from /usr/local/bin the above path.

ln -s /Applications/pgAdmin\ 4.app/Contents/SharedSupport/psql /usr/local/bin/psql

Then you can run psql anywhere in your terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.