MySQL database import large data volume SQL file failed solution

Source: Internet
Author: User

1. Before discussing this issue, first describe what is a "large data volume SQL file".

Export the SQL file. Select the database-----Right-click to select Dump SQL file-----Select structure and data. Save the file Db_mras.sql file.

2. Import the SQL file. Create a new database Db_mras in MySQL. Select Database-----Right-click to select "Run SQL File"-----Select File Db_mras.sql, run.

Now found that the run failed, prompting the error "MySQL server has gone away". The following solutions are proposed for this issue:

This error means that the link between the client and MySQL is broken, typically because SQL is running too long or the SQL file is too large.

Troubleshoot the problem cause:

(1) MySQL service is down.

Run command: Show global status like ' uptime ';  If the value of uptime is large, the MySQL service has not been restarted recently. If the log does not have the relevant information, indicating that the service has not been restarted, you can exclude this possibility.

(2) MySQL link timeout

Run command: Show global variables like '%timeout '; View the value of wait_timeout in the run result, typically 28800. On behalf of MySQL, the link closes after 28,800 seconds of mis-operation.

(3) MySQL file is too large

Run command: Show global variables like ' max_allowed_packet '; View the value of the run result Max_allowed_packet, if it is too small, you need to adjust the size.

Workaround:

At the end of MySQL My.ini file add the following words: wait_timeout=2880000;    interactive_time=2880000; max_allowed_packet=16m;

Where Max_allowed_packet represents the maximum length of the control buffer. Wait_timeout represents no action link wait time.

Restart the MySQL service after modifying the above parameters.

To see if the modification was successful: Run command: Show global variables like '%timeout '; Show global variables like ' max_allowed_packet ';

Tip: If you can't find the My.ini file, you can run the command: MySQL--help|grep my.ini to find the file path.

Note: If the above method does not solve your problem, you also need to check the space of your MySQL file installation disk is sufficient.

MySQL database import large data volume SQL file failed solution

Related Article

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.