MySQL server has gone away

Source: Internet
Author: User

General error:2006 MySQL server have gone away released: Source: Added on: 2014-10-02 23:00:56 View:146 Comments: 0

If we look at MySQL prompt MySQL server has gone away is due to a variety of reasons cause MySQL when the machine, resulting in MySQL server has gone away for many reasons, let me summarize.

My own person's experience: the first simple introduction of this novice card entry backstage, this backstage is provided to the product personnel to use, you can go to a particular game of a specific partition to enter the new card information, convenient for players to obtain, background settings of a one-time maximum input amount of 500.

Read the log first, the error content and the same log:

ERROR:SQLSTATE[HY000]: General error:2006 MySQL server have gone away

This error message is a good description of the database time-out, before listening to predecessors said, should be wait_timeout environment variable settings have a problem, but after viewing, found that Wait_timeout set the good high Ah, for 28800, should not be a problem ah, no solution.

Come back, tell, head smile without words, let me only see, don't say, code as follows:

  1. Show global variables;--phpfensi.com
  2. Set Global wait_timeout = +;

Summary resolved, but a lot of MySQL server has gone away is not related to this issue, all have and max_allowed_packet about, import database when SQLyog error.

Error Code:2006–mysql server has gone away

Search, said to be a max_allowed_packet,mysql parameter, set the value is not big enough, then I changed on the line hey.

  1. In Windows:
  2. In the MySQL Server installation directory,
  3. In My.ini file, add the following line under [Mysqld] on SERVER section .
  4. Max_allowed_packet = 16M
  5. In Linux:
  6. Copy the my-xxx.cnf file from/usr/share/mysql to/etc as my.cnf
  7. XXX can be small, medium, large, huge ... depending on the requirement .
  8. --code as follows
  9. $ cp/usr/share/mysql/my-xxx.cnf/etc/my.cnf
  10. In the my.cnf file, change the default
  11. Max_allowed_packet = 1M
  12. To
  13. Max_allowed_packet = 16M
  14. Save the file and restart MySQL server.

The error code:2006–mysql server has gone away errors when importing the. sql file today is that the imported SQL file is larger than the default Max_allowed_packet value of the system, and a lot of changes have been made to the configuration file. But did not find the My.cfg file, modify other files regardless of use, so directly using SQL statements to modify, the code is as follows:

SET GLOBAL max_allowed_packet=67108864;

Can be, not max_allowed_packet bigger the better, we can according to their own situation to set.

MySQL server has gone away

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.