{"id":2521,"date":"2022-04-01T17:18:03","date_gmt":"2022-04-01T15:18:03","guid":{"rendered":"https:\/\/ekiwi.de\/?p=2521"},"modified":"2022-04-01T17:56:41","modified_gmt":"2022-04-01T15:56:41","slug":"mysql-fehler-beim-import-query-size-is-to-max_allowed_packet","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/2521\/mysql-fehler-beim-import-query-size-is-to-max_allowed_packet\/","title":{"rendered":"MySQL: Fehler beim Import &#8222;query size is >= to max_allowed_packet&#8220;"},"content":{"rendered":"<p>Fehler beim Import einer SQL-Datei in die MySQL-Datenbank.<\/p>\n<p><!--more--><\/p>\n<p>Beim Import einer SQL-Datei hatte ich folgende Fehlermeldung:<\/p>\n<pre>\r\nquery size (1048576) is >= to max_allowed_packet (1048576)\r\n<\/pre>\n<pre>\r\nSET FOREIGN_KEY_CHECKS = ON;\r\n\r\nMySQL meldet: Dokumentation\r\n#2006 - MySQL server has gone away\r\n<\/pre>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/IClocQ4Bly0\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>Das ganze klingt nach irgendeinem Konfigurationsparameter, welcher irgendwo \u00fcberschritten wird. Das sollte sich doch beheben lassen. Ich verwende den Xampp als Server, welcher MySQL mitbringt. Der Parameter lautet &#8222;max_allowed_packet&#8220;.<\/p>\n<p>Den aktuellen Wert k\u00f6nnen wir mit folgender SQL-Abfrage erfragen:<\/p>\n<pre>\r\nSelect @@global.max_allowed_packet;\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/04\/max_sql_1.png\" alt=\"\" width=\"593\" height=\"353\" class=\"alignnone size-full wp-image-2522\" srcset=\"\/wp-content\/uploads\/2022\/04\/max_sql_1.png 593w, \/wp-content\/uploads\/2022\/04\/max_sql_1-300x179.png 300w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/p>\n<p>Der Wert ist in Bytes angegeben, was dann ca. einem MB entspricht. Um den Wert zu erh\u00f6hen k\u00f6nnen wir die Konfiguration bearbeiten. Hierzu \u00f6ffnen wir die &#8222;my.ini&#8220; bzw. &#8222;my.cnf&#8220; Datei des Servers und f\u00fcgen folgende Zeile in den &#8222;mysqld&#8220; Bereich ein:<\/p>\n<pre>\r\nmax_allowed_packet=500M\r\n<\/pre>\n<p>Anschlie\u00dfend starten wir den Server neu. Alternativ k\u00f6nnen wir den Wert auch zur Laufzeit setzen, z.B. \u00fcber phpMyAdmin. Hierzu setzen wir folgenden SQL-Befehl ab:<\/p>\n<pre>\r\nSET GLOBAL max_allowed_packet=1073741824\r\n<\/pre>\n<p>Der Wert wird damit bis zum Neustart des Servers auf den neuen Wert gesetzt.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/04\/max_sql_2.png\" alt=\"\" width=\"465\" height=\"213\" class=\"alignnone size-full wp-image-2523\" srcset=\"\/wp-content\/uploads\/2022\/04\/max_sql_2.png 465w, \/wp-content\/uploads\/2022\/04\/max_sql_2-300x137.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/p>\n<p>Anschlie\u00dfend lief der Import ohne Probleme.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/04\/max_sql_3.png\" alt=\"\" width=\"700\" height=\"156\" class=\"alignnone size-full wp-image-2524\" srcset=\"\/wp-content\/uploads\/2022\/04\/max_sql_3.png 700w, \/wp-content\/uploads\/2022\/04\/max_sql_3-300x67.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>Fehler beim Import einer SQL-Datei in die MySQL-Datenbank.<\/p>\n","protected":false},"author":1,"featured_media":159,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[12],"tags":[33,24],"class_list":["post-2521","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-datenbank","tag-mysql"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=2521"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2521\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/159"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=2521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=2521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=2521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}