Mariadb failed in bench start

Traceback (most recent call last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/middlewares.py”, line 15, in call
return super(StaticDataMiddleware, self).call(environ, start_response)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 766, in call
return self.app(environ, start_response)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 766, in call
return self.app(environ, start_response)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.py”, line 228, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/werkzeug/wrappers.py”, line 308, in application
resp = f(*args[:-2] + (request,))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py”, line 88, in application
response = handle_exception(e)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py”, line 191, in handle_exception
http_status_code=http_status_code)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 28, in render
path = resolve_path(path.strip('/ ‘))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 207, in resolve_path
path = resolve_from_map(path)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 213, in resolve_from_map
for r in get_website_rules()])
File “/home/ubuntu/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/ubuntu/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 72, in get_value
val = generator()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 231, in _get
rules = frappe.get_hooks(“website_route_rules”)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 832, in get_hooks
hooks = _dict(cache().get_value(“app_hooks”, load_app_hooks))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 72, in get_value
val = generator()
File “/home/ubuntu/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/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 774, in get_installed_apps
installed = json.loads(db.get_global(“installed_apps”) or “[]”)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 723, in get_global
return self.get_default(key, user)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 735, in get_default
d = self.get_defaults(key, parent)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 741, in get_defaults
defaults = frappe.defaults.get_defaults(parent)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/defaults.py”, line 57, in get_defaults
globald = get_defaults_for()
File “/home/ubuntu/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/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 136, in sql
self.connect()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py”, line 86, in connect
charset=‘utf8mb4’, use_unicode = True, conv = conversions)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/init.py”, line 94, in Connect
return Connection(*args, **kwargs)
File “/home/ubuntu/frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 327, in init
self.connect()
File “/home/ubuntu/frappe-bench/env/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)")

What does the output for this say…

sudo systemctl status mysqld

Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: failed (Result: exit-code) since Fri 2018-10-12 07:52:24 UTC; 1min 14s ago
Docs: man:mysqld(8)
systemd - MariaDB Knowledge Base
Process: 5018 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Process: 4864 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && system
Process: 4862 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 4861 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Main PID: 5018 (code=exited, status=1/FAILURE)
Status: “MariaDB server is down”

Oct 12 07:52:22 Cloned-newproject mysqld[5018]: 2018-10-12 7:52:22 0 [Note] InnoDB: Transaction 50693 in prepared state after recovery
Oct 12 07:52:22 Cloned-newproject mysqld[5018]: 2018-10-12 7:52:22 0 [Note] InnoDB: Transaction contains changes to 30 rows
Oct 12 07:52:22 Cloned-newproject mysqld[5018]: 2018-10-12 7:52:22 0 [Note] InnoDB: 1 transactions in prepared state after recovery
Oct 12 07:52:22 Cloned-newproject mysqld[5018]: 2018-10-12 7:52:22 0 [Note] Found 1 prepared transaction(s) in InnoDB
Oct 12 07:52:22 Cloned-newproject mysqld[5018]: 2018-10-12 7:52:22 0 [ERROR] Found 1 prepared transactions! It means that mysqld was not shut
Oct 12 07:52:22 Cloned-newproject mysqld[5018]: 2018-10-12 7:52:22 0 [ERROR] Aborting
Oct 12 07:52:24 Cloned-newproject systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Oct 12 07:52:24 Cloned-newproject systemd[1]: Failed to start MariaDB 10.3.10 database server.
Oct 12 07:52:24 Cloned-newproject systemd[1]: mariadb.service: Unit entered failed state.
Oct 12 07:52:24 Cloned-newproject systemd[1]: mariadb.service: Failed with result ‘exit-code’.
lines 1-24/24 (END)

sudo systemctl restart mysqld

should get your database up and running

Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details.

You can try this

mysqld_safe --tc-heuristic-recover=COMMIT
sudo systemctl restart mysqld

thank you i got it…