Mariadb failed in bench start again

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 72, in render
data = render_page(path)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 149, in render_page
return build(path)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 156, in build
return build_page(path)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/render.py”, line 169, in build_page
context = get_context(path)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/context.py”, line 28, in get_context
context = build_context(context)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/context.py”, line 77, in build_context
context.update(get_website_settings())
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/doctype/website_settings/website_settings.py”, line 74, in get_website_settings
‘top_bar_items’: get_items(‘top_bar_items’),
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/website/doctype/website_settings/website_settings.py”, line 131, in get_items
order by idx asc"“”, parentfield, 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)”)
when i do sudo systemctl start mariadb i get this below err
Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details.

and some one gave a solution to try this
mysqld_safe --tc-heuristic-recover=COMMIT
sudo systemctl restart mysqld

the issue solved at that time but again i get this err
Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details.
help to resolve this

Your database shutdown may be the cause of the problem - you may need to manually and explicitly stop mysqld before you power down?

Otherwise on the next session on startup, the database is in a corrupt state…

If it worked for a while, and is now misbehaving again, it might be caused by your system running out of disk space/memory/swap space. Maybe just check those parameters and items as well

1 Like

ok how to stop it manually.

how to resolve this…how to check those parameters…can u help…i dont want to lose my db.

I need to resolve this need your help.how to add the size of parameters.

systemctl stop mariadb

This command can be used also with ROLLBACK.

replace COMMIT with ROLLBACK and try again.

after executing this command mysqld_safe --tc-heuristic-recover=ROLLBACK

181013 04:44:58 mysqld_safe Logging to syslog.
181013 04:44:58 mysqld_safe A mysqld process already exists
i get this msg

okay kill the mysqld process and then try it again

are you telling me to unintsall the mariadb

no. killing the process is not uninstalling it.

/etc/init.d/mysql stop
service mysql stop
killall -KILL mysql mysqld_safe mysqld

use these commands one by one

ok what does this kill means…will i lose my db…

if you are afraid of this then dump your entire database using this command

mysql -u root -p [insert database name] > erpnext_backup.sql

you can find your currentsite’s database name in that site’s site_config.json. It is located in your site folder which should be there in frappe-bench/sites/. It will ask mysql’s root user password to confirm the action.

ok what does this kill means

Killing a process means to send a signal and stop that process from working. Whereas uninstalling is removing that application from your system.

i cant run my bench mysql so how can i dump my db where you say me to insert the db name.
mysql -u root -p [insert database name] > erpnext_backup.sql

I did mention in which file you can find your database name. Look up my last post. Copy it from site_config.json from copy it right where I have written insert database name without the square brackets.

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
after executing the command and root passwd above msg is shown

my bad the mysql isn’t working. sorry for this.

what happens when you do systemctl stop mysql. if it happens with no errors try systemctl start mysql

after sudo systemctl start mariadb command i get this:
Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details.

did you try these and then start again

2 Likes