Translate

Wednesday 3 April 2013

How To: MySQL - Set Global variable for Maximum Allowed Package

You should feel bad if you are going to import data which file size is quite big and MySQL would not accept the query because the package data being sent is too big from the maximum allowed setting. To fix this, you can set variable max_allowed_packet to accommodate the query size of your data. Here the command to run in query:

SET GLOBAL max_allowed_packet=32*1024*1024
run that command in your open connection, and that connection session will allow for a maximum 32 GB package size. but you should remember that this setting will be reset if close the connection or restart the server. To make it persistent after restarting MySQL, you should change/add this variable value to the configuration file of MySQL. In windows you can find file my.ini at your MySQL installation folder, and in Linux you can find it at /etc/my.cnf . Append this line at the end of the file:

max_allowed_packet=4096M
Try to restart and check if now you are able to sent big query size. If it still not working, try to set bigger value.

No comments:

Post a Comment