_mysql_exceptions.OperationalError OperationalError: (1045, "Access denied for user '%(db_name)s'@'

I run erpnext via:
su erpnext
cd /home/erpnext/erpnext
./lib/enf.py --serve

I connect to servername:8000 and get the following error with traceback call:

_mysql_exceptions.OperationalError

OperationalError: (1045, "Access denied for user '%(db_name)s'@'localhost' (using password: YES)")


Traceback (most recent call last):
  File "/home/erpnext/erpnext/lib/webnotes/middlewares.py", line 12, in __call__
    return super(StaticDataMiddleware, self).__call__(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 224, in application
    return ClosingIterator(app(environ, start_response), self.cleanup)
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/wrappers.py", line 285, in application
    return f(*args[:-2] + (request,))(*args[-2:])
  File "/home/erpnext/erpnext/lib/webnotes/app.py", line 50, in application
    webnotes.http_request = webnotes.auth.HTTPRequest()
  File "/home/erpnext/erpnext/lib/webnotes/auth.py", line 32, in __init__
    self.connect()
  File "/home/erpnext/erpnext/lib/webnotes/auth.py", line 93, in connect
    password = getattr(conf,'db_password', ''))
  File "/home/erpnext/erpnext/lib/webnotes/db.py", line 35, in __init__
    self.connect()
  File "/home/erpnext/erpnext/lib/webnotes/db.py", line 48, in connect
    use_unicode=True, charset='utf8')
  File "/usr/share/pyshared/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/share/pyshared/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1045, "Access denied for user '%(db_name)s'@'localhost' (using password: YES)")


The server ran fine several days ago, but this error came up - unable to proceed.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.

On Mon, Dec 30, 2013 at 9:18 PM, sa...@omnitech-electronics.com wrote:

I run erpnext via:
su erpnext
cd /home/erpnext/erpnext
./lib/enf.py --serve

I connect to servername:8000 and get the following error with traceback
call:

_mysql_exceptions.OperationalError

OperationalError: (1045, “Access denied for user ‘%(db_name)s’@‘localhost’
(using password: YES)”)

Traceback (most recent call last):
File “/home/erpnext/erpnext/lib/webnotes/middlewares.py”, line 12, in
call
return super(StaticDataMiddleware, self).call(environ,
start_response)
File “/usr/local/lib/python2.7/dist-packages/werkzeug/wsgi.py”, line
579, in call
return self.app(environ, start_response)
File “/usr/local/lib/python2.7/dist-packages/werkzeug/local.py”, line
224, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File “/usr/local/lib/python2.7/dist-packages/werkzeug/wrappers.py”, line
285, in application
return f(*args[:-2] + (request,))(*args[-2:])
File “/home/erpnext/erpnext/lib/webnotes/app.py”, line 50, in
application
webnotes.http_request = webnotes.auth.HTTPRequest()
File “/home/erpnext/erpnext/lib/webnotes/auth.py”, line 32, in init
self.connect()
File “/home/erpnext/erpnext/lib/webnotes/auth.py”, line 93, in connect
password = getattr(conf,‘db_password’, ‘’))
File “/home/erpnext/erpnext/lib/webnotes/db.py”, line 35, in init
self.connect()
File “/home/erpnext/erpnext/lib/webnotes/db.py”, line 48, in connect
use_unicode=True, charset=‘utf8’)
File “/usr/share/pyshared/MySQLdb/init.py”, line 81, in Connect
return Connection(*args, **kwargs)
File “/usr/share/pyshared/MySQLdb/connections.py”, line 187, in init
super(Connection, self).init(*args, **kwargs2)
OperationalError: (1045, “Access denied for user ‘%(db_name)s’@‘localhost’
(using password: YES)”)

This means that erpnext is not able to access mysql with the dbname,
username (same as dbname) and password in conf.py.

The server ran fine several days ago, but this error came up - unable to
proceed.


Note:

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much
    information as you can. Please see it from the point of view of the person
    receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send
    only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do
    not send images as attachments. Links are good. Same goes for any file you
    are going to send.

End of Note

You received this message because you are subscribed to the Google Groups
“ERPNext Developer Forum” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to erpnext-developer-forum+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Pratik
erpnext

Pratik,

Thank you for the reply.

I understand this MySQL error 1045 is an authentication error for the database  I am curious as to why this is happening and what we can do to fix it.

In CONF.PY under /home/erpnext/erpnext/
the # database config is as follows:
db_name =  '%(db_name)s'
db_password = '%(db_password)s'


Am I correct in assuming the user should be parsed, instead of read as a user named "%(db_name)s" ? If so , what would make this function incorrectly as such ?



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
Your conf.py did not get created correctly. the %(db_name)s should be replaced by the name you gave at time of install....

You can try again or fix conf.py with the correct credentials.

On Tuesday, December 31, 2013 7:15:48 PM UTC+5:30, sa...@omnitech-electronics.com wrote:
Pratik,

Thank you for the reply.

I understand this MySQL error 1045 is an authentication error for the database  I am curious as to why this is happening and what we can do to fix it.

In CONF.PY under /home/erpnext/erpnext/
the # database config is as follows:
db_name =  '%(db_name)s'
db_password = '%(db_password)s'


Am I correct in assuming the user should be parsed, instead of read as a user named "%(db_name)s" ? If so , what would make this function incorrectly as such ?



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.

If you are following this Development Setup | ERPNext Docker Debian one can reproduce the issue easily. It is so annoying , even changing the credentials on the Mariadb container doesnt seem to solve the problem.