OperationalError: (2003, "Can't connect to MySQL server on u'localhost' ([Errno 111] Connection refused)")

File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local.py", line 228, in application
    return ClosingIterator(app(environ, start_response), self.cleanup)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/wrappers.py", line 301, in application
    return f(*args[:-2] + (request,))(*args[-2:])
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 88, in application
    response = handle_exception(e)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 191, in handle_exception
    http_status_code=http_status_code)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 28, in render
    path = resolve_path(path.strip('/ '))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 207, in resolve_path
    path = resolve_from_map(path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 213, in resolve_from_map
    for r in get_website_rules()])
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 238, in get_website_rules
    return frappe.cache().get_value('website_route_rules', _get)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 72, in get_value
    val = generator()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py", line 231, in _get
    rules = frappe.get_hooks("website_route_rules")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 832, in get_hooks
    hooks = _dict(cache().get_value("app_hooks", load_app_hooks))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 72, in get_value
    val = generator()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 810, in load_app_hooks
    for app in [app_name] if app_name else get_installed_apps(sort=True):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 774, in get_installed_apps
    installed = json.loads(db.get_global("installed_apps") or "[]")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 723, in get_global
    return self.get_default(key, user)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 735, in get_default
    d = self.get_defaults(key, parent)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 741, in get_defaults
    defaults = frappe.defaults.get_defaults(parent)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 57, in get_defaults
    globald = get_defaults_for()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/defaults.py", line 177, in get_defaults_for
    where parent = %s order by creation""", (parent,), as_dict=1)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 136, in sql
    self.connect()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 86, in connect
    charset='utf8mb4', use_unicode = True, conv = conversions)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/__init__.py", line 94, in Connect
    return Connection(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 327, in __init__
    self.connect()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py", line 629, in connect
    raise exc
OperationalError: (2003, "Can't connect to MySQL server on u'localhost' ([Errno 111] Connection refused)")

Seems mysql service is down.

start mysql service and continue

Sorry that does not work

This post may help

This topic was automatically closed after 5 days. New replies are no longer allowed.