Slow MySQL import Solution

Source: Internet
Author: User
Tags mysql import
The SQL statement exported by MySQL may be very slow during import. Using several parameters properly during export can greatly speed up the import.

The SQL statement exported by MySQL may be very slow during import. Using a few parameters during export can greatly speed up import.

Import notes:
Using tools such as phpmyadmin or navicat to import data is still quite slow. You can directly use mysql to import data.
The import command is as follows: Mysql>-u-p <You can
Note: Mysql>-u-p <Path of the SQL file to be imported to mysql <strong>
In this way, the import will be very fast. The SQL statements that can be imported several hours ago can now be completed in dozens of seconds.

Note:
Use the multiline INSERT syntax that includes several VALUES lists;
The maximum size of the cache area for communications between clients and servers of XXX;
The size of the XXX TCP/IP and socket communication buffer, and the line with length up to net_buffer_length is created.
Note: max_allowed_packet and net_buffer_length cannot be greater than the set value of the target database. Otherwise, an error may occur.
First, determine the parameter value of the target database.
Mysql>Show variables like 'max _ allowed_packet ';
Mysql>Show variables like 'net _ buffer_length ';
Write the mysqldump Command Based on the parameter value, for example:
Mysql> mysqldump-u-p goodclassification-e -- max_allowed_packet = 1048576 -- net_buffer_length = 16384> www.jb51.net. SQL

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.