How to import large-capacity SQL file data from Mysql

Source: Internet
Author: User

Mysql may encounter the following two problems when importing an SQL file: 1. If the SQL file is too large, the "MySQL server has gone away" problem may occur;
2. if the SQL file data contains Chinese characters, the following error occurs: www.2cto.com. Problem 1: the MySQL server has gone away problem occurs because the default mysql "max_allowed_packet" variable value is too small. view current configuration
Show VARIABLES like '% max_allowed_packet % ';
The displayed result is: + ------------------ + --------- + | Variable_name | Value | + -------------------- + --------- + | max_allowed_packet | 1048576 | + ---------------------- + --------- +
The current configuration is: 1048576/1024/1024 = 1 M to modify the max_allowed_packet value:
Method 1: set global max_allowed_packet = 500*1024*1024; (tested)
Method 2: directly modify the configuration file and restart mysql www.2cto.com to modify my. INI file, modify my. cnf file. c: \ Documents ents and Settings \ All Users \ Application Data \ MySQL Server 5.5 \ my. ini (specified data file directory when mysql is installed)

After restarting mysql, check the modified max_allowed_packet value.
Question 2: When logging on, specify the character set encoding mysql-uroot-P3308-p123456--default-character-set = utf8 (-P refers to the specified port number) and then run the source command to import the data: source E: ydj \ test. SQL
Author: LoveJavaYDJ

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.