Wednesday, September 28, 2016

psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

The system used here is PostgreSQL 9.5 on CentOS 6.6.

As the postgres user, you type psql and it gives you such an error.

psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

First, check if your database server is running with the following commands

      ps -ef | grep postgres

      Which would return something like the following if the server is running.

      root      6616  4849  0 14:13 pts/2    00:00:00 su - postgres
      postgres  6617  6616  0 14:13 pts/2    00:00:00 -bash
      postgres  7219     1  0 15:42 pts/2    00:00:00 /usr/pgsql-9.5/bin/postgres
      postgres  7220  7219  0 15:42 ?        00:00:00 postgres: logger process
      postgres  7222  7219  0 15:42 ?        00:00:00 postgres: checkpointer process
      postgres  7223  7219  0 15:42 ?        00:00:00 postgres: writer process
      postgres  7224  7219  0 15:42 ?        00:00:00 postgres: wal writer process
      postgres  7225  7219  0 15:42 ?        00:00:00 postgres: autovacuum launcher process
      postgres  7226  7219  0 15:42 ?        00:00:00 postgres: stats collector process
      postgres  7239  6617  0 15:44 pts/2    00:00:00 ps -ef
      postgres  7240  6617  0 15:44 pts/2    00:00:00 grep postgres

      If it is not running, use the command below to start it.

      /usr/pgsql-9.5/bin/pg_ctl start

If you are using a different port other than the default 5432, use this command to start psql.

      psql -p <port>

---------------------------------------------------------------------------------------------------

                        

If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Order Here

No comments:

Post a Comment