When you use Sqoop to export data from hive to MySQL, you encounter an exception that is caused by the small max_allowed_packet settings of the exported database.
By executing the command in the database:
mysql> show variables like ‘max_%packet‘;+--------------------+-----------+| Variable_name | Value |+--------------------+-----------+| max_allowed_packet | 268435456 |+--------------------+-----------+
The above is the value after the change, but most of the internet is said to modify the MY.CNF, the value is directly added to the mysqld below, set to 20M above the value can be, but previously used in the configuration is very high, through observation found query_cache_ Limit value is 1M try to change this value after you find Max_allowed_packet this value also changed.
Max_allowed_packet parameters
This parameter is the size of the received packet, which takes a smaller value to catch the exception of the packet and prevents memory overflow due to the packet being too large.
Query_cache_limit parameters
This parameter specifies the size of a single query cache, should not be too large, if the data more than the case should be appropriate to increase the parameter value, but the general small data size of the query does not need to set too large otherwise causing memory fragmentation.
MySQL exception packet for query is too large (14040 > 1024)