Sunday, October 23, 2016

Re: Django can't find database

No, "peer authentication failed for user "gary"" doesn't mean that psql can't find the database; it means what it says, authentication failed.

Peer authentication is quite complicated. "psql -U gary archivedb" is a local connection (using Unix sockets I think), and by default postgresql uses peer authentication for such connections. You want to avoid it, because it will confuse you, so use "psql -h localhost -U gary archivedb"; this is a network connection to localhost:5432, and this, by default, does username/password authentication, which is what you want.

But, anyway, the problem is very likely that your database does not exist. You can create it with "sudo -u postgres createdb archivedb --owner=gary".

You must definitely get rid of the second instance that is running. Try "dpkg -l postgresql* | grep ^ii"; this will show you which postgresql packages you have installed. If you have two server packages installed, uninstall one of them with "apt-get remove [packagename]".

Regards,

Antonis Christofides
http://djangodeployment.com/


On Sat, 22 Oct 2016 16:23:48 -0700, Gary Roach <gary719_list1@verizon.net> wrote:

>
>
> psql -U gary -d archivedb gives:
> FATAL: Peer authentication failed for user "gary"
> which probably means that psql can't find the database either.
>
> My process table ( ps -xaf) shows:
> > 642 ? S 0:07 /usr/lib/postgresql/9.6/bin/postgres -D
> > /var/lib/postgresql/9.6/main -c
> > config_file=/etc/postgresql/9.6/main/postgresql.conf
> > 754 ? Ss 0:00 \_ postgres: 9.6/main: checkpointer process
> > 755 ? Ss 0:04 \_ postgres: 9.6/main: writer process
> > 756 ? Ss 0:04 \_ postgres: 9.6/main: wal writer process
> > 757 ? Ss 0:04 \_ postgres: 9.6/main: autovacuum launcher
> > process
> > 758 ? Ss 0:05 \_ postgres: 9.6/main: stats collector
> > process
> > 643 ? S 0:12 /usr/lib/postgresql/9.5/bin/postgres -D
> > /var/lib/postgresql/9.5/main -c
> > config_file=/etc/postgresql/9.5/main/postgresql.conf
> > 768 ? Ss 0:00 \_ postgres: checkpointer process
> > 772 ? Ss 0:11 \_ postgres: stats collector process
> > 6501 ? Ss 0:00 \_ postgres: postgres postgres [local] idle
>
> So the database seems to be running. No sure why there are two versions
> running but may be due to Debian using the older version of something.
> Is this a path problem?
>
> Does this help
>
> Gary R.
>
>
> On 10/22/2016 01:13 PM, Vijay Khemlani wrote:
> > Can you connect to the database via command line?
> >
> > psql -U gary -d archivedb
> >
> > On Sat, Oct 22, 2016 at 3:48 PM, Jamie Lawrence <jalawrence@gmail.com
> > <mailto:jalawrence@gmail.com>> wrote:
> >
> >
> > > On Oct 22, 2016, at 11:35 AM, Gary Roach
> > <gary719_list1@verizon.net <mailto:gary719_list1@verizon.net>> wrote:
> >
> > > When I try to migrate, I get the following error:
> > >
> > >> psycopg2.OperationalError: FATAL: database "archivedb" does not exist
> >
> >
> > > What's happening here?
> >
> > Are you certain the 'archivedb' database actually exists?
> >
> > If it does, is in in an accessible schema?
> >
> > If it is, is it in the cluster you're connecting to in Django?
> >
> > -j
> >
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4016676a-9008-8b14-54ac-79d09806bb51%40verizon.net.
> For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/E1byGa0-00070u-TJ%40rmm6prod02.runbox.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment