Solution for importing SQL files of large amounts of data from MYSQL database, mysqlsql

Source: Internet
Author: User

Solution for importing SQL files of large amounts of data from MYSQL database, mysqlsql

1. Before discussing this question, we will first introduce what is "large data SQL file ".

Export the SQL file. Select database ----- right-click and select "Dump SQL file" ----- select "structure and data ". Save the db_mras. SQL file.

2. Import the SQL file. Create a database db_mras in MYSQL. Select database ----- right-click and select "run SQL file" ----- select file db_mras. SQL to run.

If the running fails, the error "MySQL server has gone away" is displayed ". The following solutions are provided to address this problem:

This error indicates that the connection between the client and mysql is disconnected because the SQL running time is too long or the SQL file is too large.

Troubleshoot:

(1) mysql service is down

Run the command: show global status like 'uptime'; if the value of uptime is large, it indicates that the mysql service has not restarted recently. If there is no relevant information in the log, it indicates that the service has not been restarted, and this possibility can be ruled out.

(2) mysql connection timeout

Run the command: show global variables like '% timeout'; check the value of wait_timeout in the running result, generally 28800. It indicates that the link will be closed after 28800 seconds of misoperation.

(3) The mysql file is too large.

Run the command: show global variables like 'max _ allowed_packet '; view the value of max_allowed_packet in the running result. If the value is too small, you need to increase the value.

Solution:

Add the following sentence to the end of mysql my. ini file: wait_timeout = 2880000; interactive_time = 2880000; max_allowed_packet = 16 M;

Max_allowed_packet indicates the maximum length of the cache. Wait_timeout indicates no operation link wait time.

After modifying the preceding parameters, restart the mysql service.

Check whether the modification is successful: run the command: show global variables like '% timeout'; show global variables like 'max _ allowed_packet ';

TIPS: If the my. ini file cannot be found, run 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 whether your mysql file installation disk space is sufficient.

 

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.