A.2.9 Packet too largeA communication packet is a single SQL statement sent to the MySQL server or a single row that is sent to the client. In MySQL 3.23, the largest possible packet is 16MB, due to limits in the client/server protocol. In MySQL 4.0.1 and up, the limit is 1GB. When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection. With some clients, you may also get a Lost connection to MySQL server during query error if the communication packet is too large. Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server. If you are using the mysql client program, its default max_allowed_packet variable is 16MB. That is also the maximum value before MySQL 4.0. To set a larger value from 4.0 on, start mysql like this: mysql> mysql --max_allowed_packet=32M That sets the packet size to 32MB. The server's default max_allowed_packet value is 1MB. You can increase this if the server needs to handle big queries (for example, if you are working with big BLOB columns). For example, to set the variable to 16MB, start the server like this: mysql> mysqld --max_allowed_packet=16M Before MySQL 4.0, use this syntax instead: mysql> mysqld --set-variable=max_allowed_packet=16M You can also use an option file to set max_allowed_packet. For example, to set the size for the server to 16MB, add the following lines in an option file: [mysqld] max_allowed_packet=16M Before MySQL 4.0, use this syntax instead: [mysqld] set-variable = max_allowed_packet=16M It's safe to increase the value of this variable because the extra memory is allocated only when needed. For example, mysqld allocates more memory only when you issue a long query or when mysqld must return a large result row. The small default value of the variable is a precaution to catch incorrect packets between the client and server and also to ensure that you don't run out of memory by using large packets accidentally. You can also get strange problems with large packets if you are using large BLOB values but have not given mysqld access to enough memory to handle the query. If you suspect this is the case, try adding ulimit -d 256000 to the beginning of the mysqld_safe script and restarting mysqld. A.2.10 Communication Errors and Aborted ConnectionsThe server error log can be a useful source of information about connection problems. See Section 4.8.1, "The Error Log." Starting with MySQL 3.23.40, if you start the server with the --warnings option (or --log-warnings from MySQL 4.0.3 on), you might find messages like this in your error log: 010301 14:38:23 Aborted connection 854 to db: 'users' user: 'josh' If Aborted connections messages appear in the error log, the cause can be any of the following:
When any of these things happen, the server increments the Aborted_clients status variable. The server increments the Aborted_connects status variable when the following things happen:
If these kinds of things happen, it might indicate that someone is trying to break into your server! Other reasons for problems with aborted clients or aborted connections:
blog comments powered by Disqus |