A much dreaded MySQL error message during queries is “MySQL server has gone away”. بكثير من الفزع في الخلية رسالة الخطأ خلال الاستفسارات التي هي "الخلية خادم ذهبت بعيدا". An alternative message is “Lost connection to server during query”. بديل الرسالة "فقدت الصدد الى الخادم خلال الاستعلام". This is a strange problem which afflicts a wide variety of PHP software including but not limited to WordPress. وهذا هو غريب المشكلة التي تعاني منها طائفة واسعة من البرامج بما فيها بى. اتش. بى سبيل المثال لا الحصر ، WordPress. There are several causes for it. وهناك عدة اسباب لذلك. Let’s look at the common and some rare causes and what you can do to fix it. دعونا نلق نظرة على بعض المشتركة والنادرة لأسباب وما يمكنك القيام به لتصحيح الامر.

The most common causes are: اكثر الاسباب شيوعا هي :
1. The server timed out and closed the connection. الخادم بها في الوقت المناسب واغلق الصدد. By default, the server closes the connection after 8 hours or 28800 seconds if nothing has happened. افتراضيا ، خادم يغلق الصدد بعد 8 ساعات او 28800 ثانية وكأن شيئا لم يحدث. You can change the time limit by setting the wait_timeout variable when you start mysqld via your server’s /etc/my.cnf (on Linux; locate the file in installation directory on windows) as well. يمكنك تغيير الحد الزمني من خلال تحديد wait_timeout متغير عند بدء تشغيل الخادم الخاص بك عن طريق mysqld 's/ الخ / my.cnf (على لينكس ؛ موقع الملف في دليل على تركيب ويندوز) ايضا. This mostly affects persistent connections; connections opened using mysql_pconnect() in PHP. وهذا يؤثر على استمرار الاتصالات في الغالب ؛ فتحها باستخدام وصلات mysql_pconnect () في بي. اتش. بى. It can also affect pooled connections from say any server side connection pooling. كما يمكن ان تؤثر على تجميع اقول بالانترنت من أي خادم الجانب تجميع الصدد.

2. Another common reason to receive the MySQL server has gone away error is because you have issued a “close” on your MySQL connection and then tried to run a query on the closed connection. سبب اخر من الخلية لاستقبال خادم ذهبت بعيدا هو خطأ لأنك قد اصدر "اغلاق" الخاص بك على الخلية الصدد وبعد ذلك حاول تشغيل استعلام عن مغلقة الصدد. This is a simple logic problem. هذا هو المنطق البسيط للمشكلة. Are you sharing the connection across multiple threads? هل انت تقاسم الصدد عبر عدة خيوط؟

3. You got a timeout from the TCP/IP connection on the client side. الديك الخروج من برنامج التعاون الفنى / الملكيه الفكريه الصدد على الجانب العملاء. This may happen if you have been using the commands: mysql_options(…, MYSQL_OPT_READ_TIMEOUT,…) or mysql_options(…, MYSQL_OPT_WRITE_TIMEOUT,…). هذا يمكن ان يحدث اذا كنت قد تعرضت لاستخدام الاوامر : mysql_options (… ، mysql_opt_read_timeout ،…) أو mysql_options (… ، mysql_opt_write_timeout ،…). In this case increasing the timeout, as described above, may help solve the problem. في هذه الحاله زيادة فترة الاستراحه ، على النحو المبين اعلاه ، يمكن ان تساعد في حل المشكلة.

4. You have encountered a timeout on the server side and the لقد واجه فترة الاستراحه علي الخادم والجانب automatic reconnection اعادة الربط التلقائي in the client is disabled. في العميل المعوقين. Please refer to the article linked above for details and solution. يرجى الرجوع الى المادة المذكورة اعلاه للاطلاع على التفاصيل المرتبطه وايجاد حلول لها.

5. You can also get these errors if you send a query to the server that is incorrect or too large. يمكنك ايضا الحصول على هذه الاخطاء اذا كنت ارسال استفسار الى ان الخادم غير صحيح او الى حد كبير. If mysqld receives a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. اذا mysqld ان يتلقى علبة او كبير جدا من النظام ، وهو يفترض ان هناك شيئا خطأ قد ولى مع العميل ويغلق الصدد. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by setting the server’s max_allowed_packet variable, which has a default value of 1MB. اذا كنت بحاجة كبيرة الاستفسارات (على سبيل المثال ، اذا كنت تعمل مع النقطه الاعمده الكبيرة) ، يمكنك زيادة الاستعلام عن طريق تحديد الحد الخادم للmax_allowed_packet متغير ، التي لديها القيمه الافتراضيه 1 ميغابايت. You may also need to increase the maximum packet size on the client end. يمكنك ايضا على الحاجة الى زيادة الحد الأقصى لحجم علبة على العميل الغاية. More information on setting the packet size is given in Section B.1.2.9, “Packet too large”. مزيد من المعلومات حول تحديد حجم علبة ويرد في الفرع b.1.2.9 ، "علبة كبيرة للغاية".

6. An INSERT or REPLACE statement that inserts a great many rows can also cause these sorts of errors. تضاف او تحل محل اي بيان ان تدرج عدد كبير من الصفوف كما يمكن ان تسبب هذه الانواع من الاخطاء. Either one of these statements sends a single request to the server irrespective of the number of rows to be inserted; thus, you can often avoid the error by reducing the number of rows sent per INSERT or REPLACE. اما واحدة من هذه التصريحات واحدة يرسل الطلب الى الخادم بغض النظر عن عدد الصفوف لادراجها ، ومن ثم ، يمكنك تجنب الخطأ في كثير من الأحيان عن طريق الحد من عدد الصفوف التي ارسلت لكل تدرج ، او ان تحل محلها.

7. You also get a lost connection if you are sending a packet 16MB or larger if your client is older than 4.0.8 and your server is 4.0.8 and above, or the other way around. يمكنك ايضا الحصول فقدت الصدد اذا كنت بصدد ارسال علبة او 16mb اكبر اذا كان العميل الخاص بك اقدم من 4.0.8 والخادم الخاص بك هو 4.0.8 وما فوقها ، أو العكس.

Few rare causes are: اسباب قلة نادرة هي :
1. Rarely the db administrator may have killed the running thread with a KILL statement or a mysqladmin kill command. نادرا ما ديسيبل قد يكون قتل مدير ادارة الخيط مع بيان تقتل او تقتل mysqladmin القيادة.

2. A client application running on a different host does not have the necessary privileges to connect to the MySQL server from that host. عميل يعمل على تطبيق مختلف المضيفه ليس لديها ما يلزم من امتيازات توصلك الى الخلية التي تستضيف من خادم.

3. You are using a Windows client and the server had dropped the connection (probably because wait_timeout expired) before the command was issued. كنت تستخدم ويندوز العميل والخادم الغت هذا الصدد (ولعل ذلك يرجع الى wait_timeout انتهت) قبل القيادة صدر. The problem on Windows is that in some cases MySQL doesn’t get an error from the OS when writing to the TCP/IP connection to the server, but instead gets the error when trying to read the answer from the connection. المشكلة هي ان على النوافذ فى بعض الحالات الخلية لا من حصل خطأ عند كتابة القانون الأساسي لبرنامج التعاون الفنى / الملكيه الفكريه الصدد الى الخادم ، ولكن بدلا من يحصل على خطأ عند محاولة قراءة جواب من الصدد.

4. Prior to MySQL 5.0.19, even if the reconnect flag in the MYSQL structure is equal to 1, MySQL does not automatically reconnect and re-issue the query as it doesn’t know if the server did get the original query or not. قبل الخلية 5.0.19 ، حتى ولو كانت اعادة العلم في هيكل الخلية وهي تساوي 1 ، الخلية لا اعادة الاتصال تلقائيا وإعادة القضية الاستعلام لأنها لا تعرف ما اذا كان الخادم لم احصل على استفسار الاصليه ام لا.

5. It is also possible to see this error if hostname lookups fail (for example, if the DNS server on which your server or network relies goes down). ومن الممكن ايضا ان نرى اذا كان هذا الخطأ لا المضيف المشاهده (على سبيل المثال ، اذا كان الخادم على نظام أسماء النطاقات التي الخادم الخاص بك وتعتمد الشبكه او انخفاضا). This is because MySQL is dependent on the host system for name resolution, but has no way of knowing whether it is working — from MySQL’s point of view the problem is indistinguishable from any other network timeout. وذلك لأن الخلية تعتمد على النظام المضيف لاسم القرار ، ولكن ليس هناك من طريقة لمعرفة ما اذا كان العمل -- الخلية من وجهة نظر والمشكلة هي تمييزه عن أي شبكة أخرى فترة الاستراحه.

6. You may also see the MySQL server has gone away error if MySQL is started with the –skip-networking option. يمكنك ايضا ان نرى الخلية خادم ذهبت بعيدا الخلية هو خطأ اذا بدأت مع القفز - الخيار - الربط الشبكي.

7. You can also encounter this error with applications that fork child processes, all of which try to use the same connection to the MySQL server. يمكنك ايضا ان يواجه هذا الخطأ مع التطبيقات التي مفترق الطفل العمليات ، والتي تصب في محاولة لاستخدام نفس الصدد الى الخلية الخادم. This can be avoided by using a separate connection for each child process. ويمكن تجنب ذلك عن طريق استخدام مستقلة عن كل طفل الصدد العملية.

8. Another networking issue that can cause this error occurs if the MySQL port (default 3306) is blocked by your firewall, thus preventing any connections at all to the MySQL server. آخر مسألة الربط الشبكي التي يمكن ان تسبب يحدث هذا الخطأ اذا كانت الخلية ميناء (افتراضي 3306) تسد جدار الحمايه الخاص بك ، وبالتالي منع أي اتصالات على الاطلاق الى الخلية الخادم.

9. You have encountered a bug where the server died while executing the query. لقد واجه فيها علة الخادم توفي اثناء تنفيذ الاستعلام. Source مصدر

It takes time and effort to identify and solve these problems. انه يستغرق وقتا وجهدا لتحديد ولحل هذه المشاكل. Speaking from experience it is often not what it looks in the first place. تكلم من التجربه ، وهي غالبا ما لا يبدو في المقام الأول. Don’t assume anything, diligently rule out all possibilities till you solve it. لا تفترض اي شيء ، بجد استبعاد كل الاحتمالات ، حتى أنت ايجاد حل لها.