Tuesday, August 23, 2011

Re: Could not connect postgresql database

I reinstalled postgresql after deleting config files. in
postgresql.conf I changed this line:
# listen = "localhost"
to read:

listen = "*"

Also make sure this line is uncommented:
port = 5432

Then I restarted the server.
/etc/init.d/postgresql restart

One way to see if postgresql is running would be:
lsof | grep "postgres"


> createdb conntest
I asked you to create a database because if the server ISNT running
you would not be able to.

> psql -d conntest
As another suggested, this will try to use the postgres client. If
all that worked, I would've asked you to run

psql -h 127.0.0.1 -d conntest

Which, in a DEFAULT debian lenny install result in:
"psql: FATAL: password authentication failed for user "postgres"

I set a password for postgres:
su
passwd postgres

Next I change pg_hba.conf to "trust" for localhost, restarted the
server, and
psql -h 127.0.0.1 -d conntest

does work. The last step would be to use my local IP address
psql -h 192.168.1.211 -d conntest

This would make sure remote machines could connect also.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment