MySQL export data very quickly, import very slowly

Source: Internet
Author: User

MySQL export fast, import a particularly slow solution:
Add two parameters to import: Max_allowed_packet; Net_buffer_length

--max_allowed_packet the maximum size of the buffer between client/server communication;

--net_buffer_length TCP/IP and socket communication buffer sizes, creating lengths up to Net_buffer_length lines.

Note: max_allowed_packet; Net_buffer_length These two parameters can not be larger than the target data size configuration, or will be an error.

1. View the target library's parameter values as follows:

Mysql> Show variables like ' Max_allowed_packet ';
+--------------------+---------+
| variable_name | Value |
+--------------------+---------+
| Max_allowed_packet | 4194304 |
+--------------------+---------+
1 row in Set (0.01 sec)

Mysql> Show variables like ' net_buffer_length ';
+-------------------+-------+
| variable_name | Value |
+-------------------+-------+
| Net_buffer_length | 16384 |
+-------------------+-------+
1 row in Set (0.00 sec)


2. Add parameters when importing:
Mysqldump-uroot-p 123456-e--max_allowed_packet=4194304--net_buffer_length=16384 > Test.sql

MySQL export data very quickly, import very slowly

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.