简体   繁体   中英

PostgreSQL OperationalError: could not connect to server

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!

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

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

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..!!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM