1. Home
  2. Technology
  3. MySQL
  4. Increase Max Allowed Packet and Lock Wait Timeout Settings in MySQL Configuration

Increase Max Allowed Packet and Lock Wait Timeout Settings in MySQL Configuration

Background

According to MySQL discussion forums, a max_allowed_packet value that is too low (such as 4M) can cause connection issues with MySQL, which can look like the following in Variphy Logs:

ERROR … com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: 

** BEGIN NESTED EXCEPTION ** 

java.net.SocketException
MESSAGE: socket closed


STACKTRACE:
java.net.SocketException: socket closed

Resolution

Within the [mysqld] section in my.cnf (my.ini on Windows):

max_allowed_packet=100M

innodb_lock_wait_timeout=120

In running config (via MySQL cmd line or workbench):

SET GLOBAL max_allowed_packet=104857600;

SET GLOBAL innodb_lock_wait_timeout = 120; 

Updated on March 30, 2020

Was this article helpful?

Related Articles