_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')

When I try this restore command, I get the following error after about 15 Minutes. Anybody know what’s going on and how to overcome this. I tried to increase the limits in the my.cnf file in conf.d folder.

Thanks

Jay

bench --site proman --force restore /home/jay/frappe-bench/sites/proman/public/files/20170215_193210_cce32010_database.sql
MySQL root password:
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/commands/site.py”, line 103, in restore
force=context.force)
File “/home/jay/frappe-bench/apps/frappe/frappe/commands/site.py”, line 56, in _new_site
admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)
File “/home/jay/frappe-bench/apps/frappe/frappe/installer.py”, line 44, in install_db
create_auth_table()
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/password.py”, line 88, in create_auth_table
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci"“”)
File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 211, in sql_ddl
self.commit()
File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 723, in commit
self.sql(“commit”)
File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 149, in sql
self._cursor.execute(query)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (2006, ‘MySQL server has gone away’)

Do check if your server is still running, if not mysql.server start and try again

do you have swap?

Yep. I do. I created another site and restored onto it and it went through just fine. Bit intrigued as to why this problem should occur on this site. That site is still available to figure out why though.

I am in same problem. Any solution?

I fixed this issue by increasing max_allowed_packet value

login to MySQL as root user

set global max_allowed_packet=64*1024*1024;