MySQL exported SQL statements are likely to be very, very slow to import, having experienced an import of only 450,000 records for nearly 3 hours. Reasonable use of several parameters during export can greatly speed up the import.
-e uses multi-line insert syntax that includes several values lists;
--max_allowed_packet=xxx the maximum size of the buffer between client/server communication;
--net_buffer_length=xxx TCP/IP and socket communication buffer size, creating a line of length up to Net_buffer_length
Note: Max_allowed_packet and net_buffer_length cannot be larger than the target database configuration, or there may be an error.
First determine the parameter values of the target library
Mysql>show variables like ' max_allowed_packet ';
Mysql>show variables like ' net_buffer_length ';
Write mysqldump commands based on parameter values, such as:
mysql>mysqldump-uroot-proot-h192.168.0.1 Database name-e--max_allowed_packet=1048576--net_buffer_length= 16384 > SQL file
Such as:
mysql>mysqldump-uroot-proot-h192.168.0.1 discuz-e--max_allowed_packet=1048576--net_buffer_length=16384 > Discuz. SQL
SQL that was imported 2 hours ago can now be completed in a few 10 seconds.
MySQL Import export very slow workaround