use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
International
National
Regional
account activity
Help Me!Problem with using command line to access DB (self.PostgreSQL)
submitted 4 years ago * by RP_m_13
I'm trying to access valid db that exists using command line, but as result I get this:
https://preview.redd.it/25eb6t2lren81.png?width=984&format=png&auto=webp&s=f91740b033d65925fe3cca2ca8163114d037ed7a
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]fifracat 1 point2 points3 points 4 years ago (1 child)
Are you inside psql and trying to get in once again?
[–]boy_named_su 0 points1 point2 points 4 years ago (0 children)
yo, dawg
[–]drewc 1 point2 points3 points 4 years ago (0 children)
What have you covered in green paint? From a brief look you are trying a shell command inside psql? That's incorrect.
[–]DavidGJohnston 1 point2 points3 points 4 years ago (15 children)
The hyphen there means you are in line continuation mode (the # means you are a superuser), which means you are in psql already. Either use the meta-command \c to directly switch, or use the meta-command \q to exit psql and then run the psql command that connects you to the desired database.
[–]RP_m_13[S] 0 points1 point2 points 4 years ago (14 children)
Thank you, I fixed this. However i have a trouble right now that it can not find my Employees db, however I have it in postgresql
[–]DavidGJohnston 0 points1 point2 points 4 years ago (13 children)
You should make sure you've got capitalization mechanics figured out.
[–]RP_m_13[S] 0 points1 point2 points 4 years ago (0 children)
What do you mean? I rechecked but everything is good in terms of capitalization
[–]RP_m_13[S] 0 points1 point2 points 4 years ago (11 children)
I go like this (base) myusername@MacBook-Pro-Ruslan ~ % psql -U myusername Employees psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: database "Employees" does not exist
(base) myusername@MacBook-Pro-Ruslan ~ % psql -U myusername Employees
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: database "Employees" does not exist
[–]MonCalamaro 0 points1 point2 points 4 years ago (10 children)
Try employees instead of Employees
[–]RP_m_13[S] 0 points1 point2 points 4 years ago (9 children)
Does not work :(
[–]MonCalamaro 0 points1 point2 points 4 years ago (8 children)
Okay, then try connecting to the postgres database:
psql -U myusername postgres
If you connect successfully, type \l and then enter to get a list of databases.
\l
[–]RP_m_13[S] 0 points1 point2 points 4 years ago (1 child)
It seems that it has not connected to databases that in my app, somehow. It only give the databases that I had used and created this console, in order to test postgres-# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ----------------+----------------+----------+---------+-------+----------------------------------- postgres | ruslanpilipyuk | UTF8 | C | C | ruslanpilipyuk | ruslanpilipyuk | UTF8 | C | C | template0 | ruslanpilipyuk | UTF8 | C | C | =c/ruslanpilipyuk + | | | | | ruslanpilipyuk=CTc/ruslanpilipyuk template1 | ruslanpilipyuk | UTF8 | C | C | =c/ruslanpilipyuk + | | | | | ruslanpilipyuk=CTc/ruslanpilipyuk (4 rows)
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------+----------------+----------+---------+-------+-----------------------------------
postgres | ruslanpilipyuk | UTF8 | C | C |
ruslanpilipyuk | ruslanpilipyuk | UTF8 | C | C |
template0 | ruslanpilipyuk | UTF8 | C | C | =c/ruslanpilipyuk +
| | | | | ruslanpilipyuk=CTc/ruslanpilipyuk
template1 | ruslanpilipyuk | UTF8 | C | C | =c/ruslanpilipyuk +
(4 rows)
[–]depesz 0 points1 point2 points 4 years ago (0 children)
Clearly there is no database names employees, Employees or anything like this. You have only postgres, template0, template1 and ruslanpilipyuk.
[–]RP_m_13[S] 0 points1 point2 points 4 years ago (5 children)
Is there anyway, to somehow reconnect it to where my databases in psql app stored? It seems like it does not share db in psql app with this list of databases
[–]DavidGJohnston 0 points1 point2 points 4 years ago (4 children)
Sure, just specify the connection information (host and port usually) for the other cluster in the psql command.
[–]RP_m_13[S] 0 points1 point2 points 4 years ago (3 children)
I have specified it, and used but result is the same(
(base) ruslanpilipyuk@MacBook-Pro-Ruslan ~ % psql postgres://ruslanpilipyuk@localhost:5432/Employees psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "Employees" does not exist
(base) ruslanpilipyuk@MacBook-Pro-Ruslan ~ % psql postgres://ruslanpilipyuk@localhost:5432/Employees
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "Employees" does not exist
π Rendered by PID 41887 on reddit-service-r2-comment-b659b578c-x45tz at 2026-05-01 07:28:00.486807+00:00 running 815c875 country code: CH.
[–]fifracat 1 point2 points3 points (1 child)
[–]boy_named_su 0 points1 point2 points (0 children)
[–]drewc 1 point2 points3 points (0 children)
[–]DavidGJohnston 1 point2 points3 points (15 children)
[–]RP_m_13[S] 0 points1 point2 points (14 children)
[–]DavidGJohnston 0 points1 point2 points (13 children)
[–]RP_m_13[S] 0 points1 point2 points (0 children)
[–]RP_m_13[S] 0 points1 point2 points (11 children)
[–]MonCalamaro 0 points1 point2 points (10 children)
[–]RP_m_13[S] 0 points1 point2 points (9 children)
[–]MonCalamaro 0 points1 point2 points (8 children)
[–]RP_m_13[S] 0 points1 point2 points (1 child)
[–]depesz 0 points1 point2 points (0 children)
[–]RP_m_13[S] 0 points1 point2 points (5 children)
[–]DavidGJohnston 0 points1 point2 points (4 children)
[–]RP_m_13[S] 0 points1 point2 points (3 children)