MySQL import large File error resolution

Source: Internet
Author: User

command-line import large files use the source function directly

Import Database

Common source Commands

Enter the MySQL database console,

such as Mysql-u root-p

Mysql>use Database

Then use the source command, followed by the script file (such as the. SQL used here)

Mysql>source D:chai.sql


But the import small file is fine, the following error occurred in the large file:

1.ERROR 2006 (HY000) at line * * *: MySQL server has gone away
2.Got a packet bigger than ' Max_allowed_packet ' bytes or ERROR 1153 (08s01) at line 616:got a packet bigger than ' Max_all Owed_packet ' by TES
3.sqlyog Import data file problem, always remind:
There is a error while executing a query.
The query and the error message has been logged at:
C:usersliangappdataroamingsqlyogsqlyog.err.

Please click on "Open Error file ..." To open the error file.

The above problems are generally My.ini or MY.CNF parameter configuration problems

Here is a specific configuration method:

Note below [mysqld] plus the following configuration:
max_allowed_packet=768m parameter size of their own, I imported the 802M file, began to use 64m not to be converted to 768M after the success of the import

Finish modifying configuration:

Restart MySQL
net stop MySQL shutdown
net start MySQL Startup

Go to MySQL to see if it's successful
Show variables like '%max_allowed_packet% ';

The display is as follows:
Max_allowed_packet | 805306368 explains the modification was successful.

Re-import, haha import success!


Some friends may run into other problems.

Problems with the database character set will appear with the error at Line:unknown Command '. The following command can be used to resolve the problem.

--default-character-set=utf8

That

Mysql-u User name-p password database name < SQL file path--default-character-set=utf8

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.