密码正确但是oracle验证失败,psycopg2.operational错误:致命:用户“的密码验证失败”...

我对网络开发还很陌生。

首先,我在我的vps(Ubuntu 16.04)上部署了一个静态网站,没有问题,然后我试图添加一个博客应用程序。

它在本地与PostgreSQL很好地工作,但我不能让它在我的服务器上工作。

它似乎试图与我的Unix用户连接到Postgres。

为什么我的服务器要这么做?

我确实通过postgres用户创建了一个数据库和一个所有者,匹配settings.py中的登录信息,我希望psycopg2尝试使用这些登录信息连接到数据库:

Settings.py+python解耦:DATABASES = {

'default': {

'ENGINE': 'django.db.backends.postgresql_psycopg2',

'NAME': config ('NAME'),

'USER': config ('USER'),

'PASSWORD': config ('PASSWORD'),

'HOST': 'localhost',

'PORT': '',

}

}

这是每次尝试./manage.py migrate时收到的错误消息

“myportfolio”是我的Unix用户名,数据库用户名不同:Traceback (most recent call last):

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection

self.connect()

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/base/base.py", line 194, in connect

self.connection = self.get_new_connection(conn_params)

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 168, in get_new_connection

connection = Database.connect(**conn_params)

File "/home/myportfolio/lib/python3.5/site-packages/psycopg2/__init__.py", line 130, in connect

conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

psycopg2.OperationalError: FATAL: password authentication failed for user "myportfolio"

FATAL: password authentication failed for user "myportfolio"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "./manage.py", line 15, in

execute_from_command_line(sys.argv)

File "/home/myportfolio/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line

utility.execute()

File "/home/myportfolio/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "/home/myportfolio/lib/python3.5/site-packages/django/core/management/base.py", line 288, in run_from_argv

self.execute(*args, **cmd_options)

File "/home/myportfolio/lib/python3.5/site-packages/django/core/management/base.py", line 335, in execute

output = self.handle(*args, **options)

File "/home/myportfolio/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 79, in handle

executor = MigrationExecutor(connection, self.migration_progress_callback)

File "/home/myportfolio/lib/python3.5/site-packages/django/db/migrations/executor.py", line 18, in __init__

self.loader = MigrationLoader(self.connection)

File "/home/myportfolio/lib/python3.5/site-packages/django/db/migrations/loader.py", line 49, in __init__

self.build_graph()

File "/home/myportfolio/lib/python3.5/site-packages/django/db/migrations/loader.py", line 206, in build_graph

self.applied_migrations = recorder.applied_migrations()

File "/home/myportfolio/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 61, in applied_migrations

if self.has_table():

File "/home/myportfolio/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 44, in has_table

return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/base/base.py", line 255, in cursor

return self._cursor()

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/base/base.py", line 232, in _cursor

self.ensure_connection()

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection

self.connect()

File "/home/myportfolio/lib/python3.5/site-packages/django/db/utils.py", line 89, in __exit__

raise dj_exc_value.with_traceback(traceback) from exc_value

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection

self.connect()

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/base/base.py", line 194, in connect

self.connection = self.get_new_connection(conn_params)

File "/home/myportfolio/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 168, in get_new_connection

connection = Database.connect(**conn_params)

File "/home/myportfolio/lib/python3.5/site-packages/psycopg2/__init__.py", line 130, in connect

conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

django.db.utils.OperationalError: FATAL: password authentication failed for user "myportfolio"

FATAL: password authentication failed for user "myportfolio"

我试着:删除我的django代码,重新安装

删除/清除postgres并重新安装

将pg_hba.conf local修改为信任

有一次,我创建了一个名为“myportfolio”的django超级用户作为我的unix用户:这会产生问题吗?

你可能感兴趣的:(密码正确但是oracle验证失败,psycopg2.operational错误:致命:用户“的密码验证失败”...)