2

For the first time today I ran into this error:

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.5432"?

I am running a simple Django blog, locally using PostgreSQL.

When I run:

ps auxw | grep postgres

I get the following:

Chris    3260    0.5   0.0  2432768    620 s000  R+   11:37AM   0:00.00 grep postgres

The last time I was able to successfully use PostgreSQL was last night. I have not changed anything since then, so it might be something to do with my computer maybe?

If you need anymore info, just ask me :) Thanks for your help!

Chris Frank
  • 4,124
  • 4
  • 30
  • 42
  • 1
    Your ps-output indicates that PG is not running. Do you have a valid /etc/init.d/postgresql start/stop scrift for it? Has the machine been powered down, since pg was functioning? – wildplasser Oct 20 '12 at 15:49
  • I looked in my /etc/ folder and there was not a init.d file/folder. This morning when I my machine was turning on after being in sleep mode for the night it acted a little weird so I had to reboot. – Chris Frank Oct 20 '12 at 15:56
  • Could also be `/etc/rc.d/...`, depending on the unix flavour. If you previously had a working start-up script, the start might have failed. Check the logs. – wildplasser Oct 20 '12 at 15:58
  • I was looking at some of the logs after I tried to run syncdb, and the first Traceback error I am receiving is pointing at my manage.py file. The line "execute_from_command_line(sys.argv)" seems to be causing a problem. Do you know anything about this? – Chris Frank Oct 20 '12 at 16:04
  • What OS/distro/version is it? Check the PostgreSQL log files for messages that might inform you of why Pg stopped / failed to start. – Craig Ringer Oct 20 '12 at 16:06
  • I'll look for all that info. Here is the Traceback from django http://dpaste.com/815952/ – Chris Frank Oct 20 '12 at 16:08
  • [Here][1] is a good answer which is posted before. [1]: http://stackoverflow.com/a/5500831/1796520 – met1366 Feb 18 '14 at 13:03

3 Answers3

1

The problem had to do with the way I shut down my computer. A simple restart fixed my problem.

Chris Frank
  • 4,124
  • 4
  • 30
  • 42
1

The problem is that the PostgreSQL has stopped so must start it. Try the below command for starting the PostgreSQL:

To check the status:

sudo /etc/init.d/postgres status

To start:

sudo /etc/init.d/postgresql start

Pravitha V
  • 3,308
  • 4
  • 33
  • 51
-2

First Of All, You Should have to remove postgres First

Go To Root

root@erp-Inspiron-1545:/home/erp# apt-get --purge remove postgresql

After Unstalling Postgres

rm -r /etc/postgresql/

rm -r /etc/postgresql-common/

rm -r /var/lib/postgresql/

userdel -r postgres

groupdel postgres

apt-get install postgresql

Now Go to Postgres

su postgres

type this command:-

alter user postgres with password 'postgres';

Now Go Back to odoo path & Restart Your server..!!!!