Solution for importing SQL files from MySQL is too large or connection timeout

Source: Internet
Author: User

Solution for importing SQL files from MySQL is too large or connection timeout

Some time ago, when I was on a business trip for development at the site, there was always a problem importing MySQL databases. Finally, we found a magic SQL statement for implementation. If an import error occurs, we can execute the following statement. So far, it has been a trial.

Set global max_allowed_packet = 100 000 000;
Set global net_buffer_length = 100000;
Set global interactive_timeout = 28800 000;
Set global wait_timeout = 28800000

Explanation of the preceding statement:

-Max_allowed_packet = maximum size of the cache for communications between the XXX client/server;

-Net_buffer_length = XXX TCP/IP and socket communication buffer size, create line with length up to net_buffer_length

Interactive_timeout = 10; valid for subsequent interaction links;

Wait_timeout is valid for the current interactive link;

========================================================== =====

The preceding statement mainly solves the following problems: Connection timeout and the imported SQL file is too large.

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

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.