Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MySql max_allowed_packet

Posted on 2011-09-20
8
Medium Priority
?
1,030 Views
Last Modified: 2012-06-12
I setup new LAMP VM (has 4Gb ram) and need to restore 9Gb sql file to a database in MySQL.
I configured my.cnf file with
[mysql]
max_allowed_packet=2G


I try to import sql file with 'mysql' command with '--max_allowed_packet' option but failed with below message.

Get a packet bigger than 'max_allowed_packet' bytes.

I figured out the packet size in phpmyadmin but ...
@@max_allowed_packet
1048576

Any suggestion?
0
Comment
Question by:Ken_Kim
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
8 Comments
 
LVL 3

Accepted Solution

by:
nbhu earned 2000 total points
ID: 36566775
Hi,
The default is 1MB,2G is more than the upper limit, max is 1G.
From Mysql documentation:
max_allowed_packet
Command-Line Format       --max_allowed_packet=#
Option-File Format       max_allowed_packet
Option Sets Variable       Yes, max_allowed_packet
Variable Name       max_allowed_packet
Variable Scope       Global
Dynamic Variable       Yes
        Permitted Values
Type       numeric
Default       1048576
Range       1024 .. 1073741824

The maximum size of one packet or any generated/intermediate string.

The packet message buffer is initialized to net_buffer_length bytes, but can grow up to max_allowed_packet bytes when needed. This value by default is small, to catch large (possibly incorrect) packets.

You must increase this value if you are using large BLOB columns or long strings. It should be as big as the largest BLOB you want to use. The protocol limit for max_allowed_packet is 1GB. The value should be a multiple of 1024; nonmultiples are rounded down to the nearest multiple.

When you change the message buffer size by changing the value of the max_allowed_packet variable, you should also change the buffer size on the client side if your client program permits it. On the client side, max_allowed_packet has a default of 1GB. Some programs such as mysql and mysqldump enable you to change the client-side value by setting max_allowed_packet on the command line or in an option file.

The session value of this variable is read only.

Regards, nbhu
0
 
LVL 3

Expert Comment

by:nbhu
ID: 36566794
P.S.
I think your setting is too big, so it is invalid and ignored.
@@max_allowed_packet
1048576
This is the dafault setting.
Regards, nbhu
0
 

Author Comment

by:Ken_Kim
ID: 36566822
It's only working in session like putty.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:nbhu
ID: 36567233
Hi,
You can put it in my.ini or my.cnf, so it remains always valid.
We do this on windows, and it is working.
Regards, nbhu
0
 
LVL 3

Expert Comment

by:nbhu
ID: 36567243
You have to put it in the following section:
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306
max_allowed_packet=4M


Regards, nbhu
0
 
LVL 3

Expert Comment

by:pete-mcpetey
ID: 37819386
If it's working in a PuTTY SSH session, you're good. There is no way you are going to get a 9GB file through a client like phpMyAdmin.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question