0

I tried running a postgres server to viewing my databases with TablePlus after not doing so for a while.

Running the server:

brew services start postgresql
Warning: Formula postgresql was renamed to postgresql@14.
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/eliott/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist` exited with 5.
➜  ~ brew services restart postgresql
Warning: Formula postgresql was renamed to postgresql@14.
Stopping `postgresql@14`... (might take a while)
==> Successfully stopped `postgresql@14` (label: homebrew.mxcl.postgresql@14)
==> Successfully started `postgresql@14` (label: homebrew.mxcl.postgresql@14)

When I ran psql it returned this error:

psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory Is the server running locally and accepting connections on that socket?

… and something similar in TablePlus.

The version was 14.7 at this point so decided to install 15 with homebrew brew install postgresql@15 (though the version is now only 14.8) but now the error has changed to:

psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: FATAL: database “eliott” does not exist

in TablePlus:

connection to server at “127.0.0.1”, port 5432 failed: FATAL: database “eliott” does not exist

When I run psql -l, the following is returned:

List of databases
   Name    | Owner  | Encoding | Collate | Ctype | Access privileges 
-----------+--------+----------+---------+-------+-------------------
 postgres  | eliott | UTF8     | C       | C     | 
 template0 | eliott | UTF8     | C       | C     | =c/eliott        +
           |        |          |         |       | eliott=CTc/eliott
 template1 | eliott | UTF8     | C       | C     | =c/eliott        +
           |        |          |         |       | eliott=CTc/eliott
(3 rows)

EDIT: the CLI works now but what I didn't realise before from running psql -l is that all the databases I used to have are gone now. I'm guessing I may have deleted them by accident(?) or is there the possibility that postgres/tableplus is looking for the wrong path?

Eliott
  • 1
  • 2
  • 1
    try 'psql -d postgres'. as you can see "eliott" database is not there. "eliott" role is there. when you type "eliott" the system may assume default database name as "eliott". – jian Jun 27 '23 at 13:33
  • @jian thank you. the CLI works now but what I didn't realise before from running `psql -l` is that all the databases I have are gone now. I'm guessing I may have deleted them by accident(?) or is there the possibility that postgres/tableplus is looking for the wrong path? – Eliott Jun 27 '23 at 16:53
  • if `CLI` works, which means, you must connect to at least one database. if you didn't see any tables, that probably because of search_path. try google around postgres search_path. for example `psql -p 5421 -d test16` works, means you connect to database test16. but after you are IN,you maybe see nothing because of privilege or search_path config. – jian Jun 28 '23 at 00:23

0 Answers0