Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgres does not know where to find server configuration

Tags:

postgresql

I' trying to run PostgreSQL for RoR on my new mac (i'm a newbie). I followed the installation guide however i can't get it to work properly. I've found similar questions but those didn't help. I get the following error on 'postgres' cmd.

postgres does not know where to find the server configuration file. You must specify the --config-file or -D invocation option or set the  PGDATA environment variable. 

however when I set my -D invocation through

postgres -D /usr/local/var/postgres 

I get another error

FATAL:  lock file "postmaster.pid" already exists HINT:  Is another postmaster (PID 6621) running in data directory     "/usr/local/var/postgres"? 

I've tried to use 'kill 6621' but then it just seems to startup another postmaster on a different PID. I've also tried removing PID and running

postgres -D /usr/local/var/postgres 

I get the following errors:

LOG:  could not bind IPv6 socket: Address already in use HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry. LOG:  could not bind IPv4 socket: Address already in use HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry. WARNING:  could not create listen socket for "localhost" FATAL:  could not create any TCP/IP sockets 

Does anyone know what i'm doing wrong?

like image 806
Mischa Avatar asked Sep 17 '15 11:09

Mischa


People also ask

Where is Postgres config located?

PostgreSQL configuration files are stored in the /etc/postgresql/<version>/main directory. For example, if you install PostgreSQL 12, the configuration files are stored in the /etc/postgresql/12/main directory. To configure IDENT authentication, add entries to the /etc/postgresql/12/main/pg_ident. conf file.

Could not connect to server could not connect to server No such file or directory?

When connecting to Postgres you might see this error: psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket <some socket> . This happens most often when Postgres' server daemon process is not running.

How do I know if Postgres is installed on my server?

Check Postgres Version from SQL Shell Type the following SQL statement within the prompt to check the current version: SELECT version(); The resulting output provides the full version and system information for the PostgreSQL server.


1 Answers

Usually, when postgres is installed a service/daemon is created in the system so, there is no need to launch the server by hand. You are getting the error because the service is already running.

Try to connect to the database using psql

like image 165
Francisco Puga Avatar answered Sep 17 '22 13:09

Francisco Puga