Forums

FATAL: password authentication failed for user

I'm getting the above error when I try to run

python manage.py makemigrations

I can't remember my password, and can't access the /etc/passwd files as several guides online have suggested. Does anyone have any suggestions? Also, how would I go about entering a password once I'd reset it?

Many thanks

if this is your django webapp user password, you should go into django to change it. For example, see this.

If you mean your pythonanywhere password, you can reset it here.

Alternatively, if the error is from the wrong MySQL database password, try resetting the password from your databases tab on pythonanywhere.

Thanks Conrad - I think it is the django webapp password. When I cd into the directory with my manage.py, and run

python manage.py changepassword

I get the following error :

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 329, in execute
    self.check_migrations()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/core/management/base.py", line 422, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
    self.build_graph()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 209, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations
    self.ensure_schema()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/home/DMells123/.virtualenvs/nomadpad-virtualenv/local/lib/python2.7/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 "DMells123"

[edited by admin: formatting]

That sounds like your database. Are you using mysql? what is your django db settings? (but dont' show your password here in the forums)

Hi Conrad, I'm using postgresql. My settings are :

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'nomadpaddb', 'USER': 'super', 'HOST': 'DMells123-678.postgres.pythonanywhere-services.com', 'PORT':'10678', } }

Is there a specific command like syncdb or something?

I meant to say that it sounds like you have the wrong password for your database.

You can reset your Postgres password on the PythonAnywhere databases tab. Then there are two things to confirm:

  1. Try starting a postgres console from the DB tab- if it connects this means that you should be able to connect as well
  2. Try using the psql command to connect manually yourself. If this fails, double check your password in the ~/.pgpass file is what you expect. eg: did you use a weird unicode character that didn't register properly?
  3. Make sure you are using the same settings that you used for the psql command in your django settings, and reload your webapp

I just had the same problem with a postgres database (not on PA). My tip: restrict yourself to lowercase when naming databases and users. The above problem might result from django not being able to connect the user "DMells123" when postgres actually expects "dmells123".

That's useful to know, thanks for posting that!

I changed the details to lowercase and it worked fine. Also set a password without $ and #.

aha! thanks for letting us all know.