PostgreSQL does not work: could not connect to server

Asked 2 years ago, Updated 2 years ago, 57 views

PostgreSQL does not seem to work on macOS.

$brew services list 
Name Status User Plist
mysql stopped 
postgresql error user/Users/user/Library/LaunchAgent/homebrew.mxcl.postgresql.plist

By the way, psql-l cannot connect to PostgreSQL and cannot verify that the database list can be retrieved.

$psql-l
psql: error: could not connect to server: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.532"?

There seems to be no similar question, and I can't find anything like it when I google it.

I would appreciate it if you could give me a hint.

Additional Tasks

$brew services start postgresql 
==>Successfully started postgresql(label:homebrew.mxcl.postgresql) 

$ brew services list 
Name Status User Plist
mysql stopped
postgresql error XXXXXXXX/Users/XXXXXX/Library/LaunchAgent/homebrew.mxcl.postgresql.plist 

postgres-D/usr/local/var/log/postgres.log 
postgres: could not access the server configuration file "/usr/local/var/log/postgres.log/postgresql.conf"—Not a directory 

postgres-D/usr/local/var/postgres 
postgres: could not access the server configuration file "/usr/local/var/postgres/postgresql.conf "—No such file or directory 
$pg_ctl-l/usr/local/var/postgres/server.log start
pg_ctl —no database directory specified and environment variable PGDATA unset Try "pg_ctl --help" for more information.

Review Logs

$less/usr/local/var/log/postgres.log

it
2021-02-1008:05:11.179 JST[615]LOG:listening on IPv6 address"::1", port54
32
2021-02-1008:05:11.179 JST[615]LOG:listening on IPv4 address "127.0.0.1", port532
2021-02-1008:05:11.224 JST[615]LOG:listening on Unix socket"/tmp/.s.PGSQL.532"
2021-02-1008:05:11.921 JST [711] LOG:database system was shut down at 2021-02-09 19:40:12 JST
2021-02-1008:05:12.030JST[615]LOG:database system is ready to accept connections
2021-02-1008:34:50.887JST[615] LOG:received smart shutdown request
2021-02-1008:34:50.966 JST[615] LOG:background worker "logical replication launcher" (PID718) exit with exit code 1
2021-02-1008:34:50.982JST[713]LOG:shutting down
2021-02-1008:34:51.031 JST [615] LOG:database system is shutdown
2021-02-1008:51:34.474 JST[1759]LOG:starting PostgreSQL 12.3 on x86_64-apple-darwin 19.4.0, compiled by Apple clang version 11.0.3 (clang-1103.0.32.59), 64-bit
2021-02-1008:51:34.476 JST[1759] LOG:listening on IPv6 address"::1", port532
2021-02-1008:51:34.476 JST[1759]LOG:listening on IPv4 address "127.0.0.1", port532
:

postgresql

2022-09-30 19:19

1 Answers

I tried running brew uninstall postgresql, but I got the following error and tried it.

$sudo town-R "$USER": admin/usr/local

Enter the PW after entering

$brew uninstall postgresql
Uninstalling/usr/local/Cellar/postgresql/12.3_4...(3,220 files, 37.8MB)
postgresqlare still installed.
To remove all versions, run:

$brew uninstall --force postgresql⭐ これ Do this to clean everything

$brew install postgresql reinstalls with error.

Error: 
  homebrew-core is a show clone.
To `brew update`, first run:

$ bundle install -- path vendor/bundle
$ rails db:migrate
$ rails db:create

Boot up safely!

Note:


2022-09-30 19:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.