Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to set the value of max_allowed_packet
or wait_timeout
for MySQL service (which serves client databases)?
Answer
Follow the steps below to achieve the same:
- Connect to Plesk server via SSH
-
Set the max_allowed_packet or wait_timeout value in
[mysqld]
and[mysqldump]
sections ofmy.cnf
file.-
For Debian/Ubuntu:
CONFIG_TEXT: /etc/mysql/my.cnf
-
For CentOS/RHEL/CloudLinux:
CONFIG_TEXT: /etc/my.cnf
CONFIG_TEXT: [mysqld]
wait_timeout = 31536000
max_allowed_packet=32M
....
[mysqldump]
max_allowed_packet=32M -
For Debian/Ubuntu:
-
Restart MySQL service:
# service mysql restart || service mariadb restart || service mysqld restart
- Connect to Plesk server via RDP
-
Set the max_allowed_packet or wait_timeout value in
[mysqld]
and[mysqldump]
sections of%plesk_dir%Databases\MySQL\my.ini
file.CONFIG_TEXT: [mysqld]
wait_timeout = 31536000
max_allowed_packet=32M
....
[mysqldump]
max_allowed_packet=32MNote: wait_timeout=31536000 is the maximum supported value in MySQL server.
- After saving the file, restart MySQL process via Plesk Services Monitor (it can be found in system tray):
Comments
9 comments
I increased max_allowed_packet editing the right my.cnf file, and I confirmed using phpMyAdmin that the new value is applying.
Periodically, max_allowed_packet reset itself to 1024, even lower than MySQL default (that is 4M), crashing the majority of websites relying on MySQL.
@Marco Marsala
Hello!
Such behavior is caused by MySQL Bug.
See also MySQL forum topic regarding this issue.
@Ivan Postnikov
This is classified as “not a bug”. The forum topic says that 3rd party software is running a query to reset the value to 1024.
My code never run such query. The only 3rd party running on the server is Plesk panel.
Maybe this is a Plesk issue?
@Marco Marsala
Hello!
In this case, I would suggest submitting a ticket for Plesk Technical Support, as more detailed investigation is required.
Should Screenshot for Windows Plesk be updated so thick would be on "SQL Server" group or "MySQL56" service and not on "Plesk SQL Server"?
@Almir The article has been updated, thank you!
Thank you
I use centos 7 with plesk
For CentOS
Command: vi /etc/my.cnf
This code is not visible.
[mysqld]
wait_timeout = 31536000
max_allowed_packet=32M
....
[mysqldump]
max_allowed_packet=32M
You need add this line
Hello Edwynn Flores Martínez
Yes, correct. It is needed to add these parameters in the /etc/my.cnf configuration file.
Please sign in to leave a comment.