首页 > 解决方案 > How to import a 10GB file to MySQL?

问题描述

"I am trying to import a backup file to MySQL. The file is 10GB but the problem I get an error when the backup reach the limit of max_allowed_packet which is: 1GB. Any idea how can I increase this number to 10GB ?"

I've tried to use this command:

mysql -u username -p database_name < file.sql

But i get the same error

I expect that i have to change the max_allowed_packet and net_buffer_length but how could i do that ?

Thank you!

标签: mysqldatabase

解决方案


通过mysql命令行客户端设置max_allowed_pa​​cket和net_buffer_length

set global net_buffer_length=10000000; 

set global max_allowed_packet=10000000000;

推荐阅读