Centos7 solves django. db. utils. OperationalError: FATAL: Peer authentication failed for user & quot; S & quot;, userauthentication

Source: Internet
Author: User
Tags unix domain socket

Centos7 solves django. db. utils. OperationalError: FATAL: Peer authentication failed for user "s", userauthentication

After the postgre database is installed in yum under centos7, the database connection configuration is located in/var/lib/pgsql/data/pg_hba.conf.

The following error message is returned when you perform database migration.

[root@localhost codeoncloud]# python manage.py migrateTraceback (most recent call last):  File "manage.py", line 10, in <module>    execute_from_command_line(sys.argv)  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line    utility.execute()  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute    self.fetch_command(subcommand).run_from_argv(self.argv)  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv    self.execute(*args, **cmd_options)  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute    output = self.handle(*args, **options)  File "/usr/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle    executor = MigrationExecutor(connection, self.migration_progress_callback)  File "/usr/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__    self.loader = MigrationLoader(self.connection)  File "/usr/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__    self.build_graph()  File "/usr/lib/python2.7/site-packages/django/db/migrations/loader.py", line 180, in build_graph    self.applied_migrations = recorder.applied_migrations()  File "/usr/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations    self.ensure_schema()  File "/usr/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):  File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 162, in cursor    cursor = self.make_debug_cursor(self._cursor())  File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 135, in _cursor    self.ensure_connection()  File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection    self.connect()  File "/usr/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__    six.reraise(dj_exc_type, dj_exc_value, traceback)  File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection    self.connect()  File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 119, in connect    self.connection = self.get_new_connection(conn_params)  File "/usr/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 176, in get_new_connection    connection = Database.connect(**conn_params)  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect    conn = _connect(dsn, connection_factory=connection_factory, async=async)django.db.utils.OperationalError: FATAL:  Peer authentication failed for user "postgres"

Change row 80th in/var/lib/pgsql/data/pg_assist.conf to the following

 79 # "local" is for Unix domain socket connections only 80 local   all             all                                     trust



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.