Maximum Query Size for MySQL
In MySQL, executing excessively long queries can occasionally cause server disruptions. To address this issue, MySQL has a configurable setting that defines the maximum permissible query size.
To determine your current server setting, use the following command:
SHOW VARIABLES LIKE 'max_allowed_packet';
The output provides the maximum query size in bytes. For instance, a value of "max_allowed_packet=1048576" indicates a limit of 1 megabyte (MiB).
If you encounter issues with overly long queries, you may need to increase the value of 'max_allowed_packet.' To do so, add the following line to your MySQL configuration file (e.g., my.cnf):
max_allowed_packet = new_size_in_bytes
Once you have adjusted the setting, restart MySQL to apply the change.
The above is the detailed content of How Can I Adjust MySQL's Maximum Query Size?. For more information, please follow other related articles on the PHP Chinese website!