{"id":340,"date":"2014-06-18T18:31:04","date_gmt":"2014-06-18T22:31:04","guid":{"rendered":"http:\/\/www.amixa.com\/blog\/?p=340"},"modified":"2014-06-18T18:33:19","modified_gmt":"2014-06-18T22:33:19","slug":"mysql-import-fails-with-error-2006-hy000-at-line-44-mysql-server-has-gone-away","status":"publish","type":"post","link":"https:\/\/www.amixa.com\/blog\/2014\/06\/18\/mysql-import-fails-with-error-2006-hy000-at-line-44-mysql-server-has-gone-away\/","title":{"rendered":"MYSQL import fails with &#8220;ERROR 2006 (HY000) at line 44: MySQL server has gone away&#8221;"},"content":{"rendered":"<p>Recently I was attempting to import a large (136mb) SQL backup for a new client.<\/p>\n<p>I first created a database and db user in PHPMYADMIN (most current version).<\/p>\n<p>Then using my Windows workstation, I launched MySQL Workbench 6.1 (my favorite tool for importing\/exporting) and tried to do a Server&#8211;&gt;Data Import.<\/p>\n<p>Pointed it to the 136mb file and first had a problem:<\/p>\n<pre>17:45:03 Restoring Z:\\whateverdatabase.sql Running: mysql.exe --defaults-file=\"c:\\users\\aaa\\appdata\\local\\temp\\tmp8pbfwe.cnf\"\u00a0 --host=192.168.x.x --user=root --port=3306 --default-character-set=utf8 --comments --database=btb-old &lt; \"Z:\\\\whateverdatabase.sql\" ERROR 2006 (HY000) at line 44: MySQL server has gone away\r\nOperation failed with exitcode 1\r\n17:45:04 Import of Z:\\whateverdatabase.sql has finished with 1 errors\r\n<\/pre>\n<p>Want an easy solution for this?\u00a0 It turns out there is a limit in the MySQL database for the size of imports&#8230;<\/p>\n<p>Run this SQL statement against the MySQL database:<\/p>\n<pre class=\"lang-sql prettyprint prettyprinted\" style=\"font: 14px\/17.8px Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px 0px 10px; padding: 5px; border: 0px currentColor; width: auto; text-align: left; color: #000000; text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: auto; word-spacing: 0px; vertical-align: baseline; -ms-word-wrap: normal; max-height: 600px; background-color: #eeeeee; -webkit-text-stroke-width: 0px;\"><code style=\"margin: 0px; padding: 0px; border: 0px currentColor; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; vertical-align: baseline; white-space: inherit; background-color: #eeeeee;\"><span class=\"kwd\" style=\"margin: 0px; padding: 0px; border: 0px currentColor; color: #00008b; font-size: 14px; vertical-align: baseline; background-color: transparent;\">SET<\/span><span class=\"pln\" style=\"margin: 0px; padding: 0px; border: 0px currentColor; color: #000000; font-size: 14px; vertical-align: baseline; background-color: transparent;\"> GLOBAL max_allowed_packet<\/span><span class=\"pun\" style=\"margin: 0px; padding: 0px; border: 0px currentColor; color: #000000; font-size: 14px; vertical-align: baseline; background-color: transparent;\">=<\/span><span class=\"lit\" style=\"margin: 0px; padding: 0px; border: 0px currentColor; color: #800000; font-size: 14px; vertical-align: baseline; background-color: transparent;\">250x1024x1024<\/span><span class=\"pun\" style=\"margin: 0px; padding: 0px; border: 0px currentColor; color: #000000; font-size: 14px; vertical-align: baseline; background-color: transparent;\">;<\/span><\/code><\/pre>\n<p>In my case, I picked a size (250mb) (above) that is larger than my SQL import.<\/p>\n<p>Execute that script.<\/p>\n<p>Re-run the import.\u00a0 Works perfectly!<\/p>\n<pre>17:47:42 Restoring Z:\\whateverdatabase.sql\r\nRunning: mysql.exe --defaults-file=\"c:\\users\\aaa\\appdata\\local\\temp\\tmpwpesfe.cnf\"\u00a0 --host=192.168.x.x --user=root --port=3306 --default-character-set=utf8 --comments --database=btb-old &lt; \"Z:\\\\whateverdatabase.sql\"\r\n17:50:18 Import of Z:\\whateverdatabase.sql has finished<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I was attempting to import a large (136mb) SQL backup for a new client. I first created a database and db user in PHPMYADMIN (most current version). Then using my Windows workstation, I launched MySQL Workbench 6.1 (my favorite tool for importing\/exporting) and tried to do a Server&#8211;&gt;Data Import. Pointed it to the 136mb file and first had a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[104],"class_list":["post-340","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysql"],"_links":{"self":[{"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/comments?post=340"}],"version-history":[{"count":3,"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/posts\/340\/revisions"}],"predecessor-version":[{"id":343,"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/posts\/340\/revisions\/343"}],"wp:attachment":[{"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/media?parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/categories?post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amixa.com\/blog\/wp-json\/wp\/v2\/tags?post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}