Question
How to customize MySQL variables (e.g. max_allowed_packet
, read_buffer_size
or wait_timeout
) on a Plesk server?
Answer
Note: Custom values must not exceed the limits defined by MySQL. For example, the highest value for max_allowed_packet
is 1073741824 bytes (1024M) for wait_timeout
- 31536000 seconds.
- Connect to the Plesk server via SSH.
-
Open the my.cnf file in a text editor. In this example, we are using the vi editor:
- on CentOS/RHEL-based distributions:
# vi /etc/my.cnf
- on Debian/Ubuntu-based distributions:
# vi /etc/mysql/my.cnf
- on CentOS/RHEL-based distributions:
-
Add your custom variables under the
[mysqld]
section. If the variable is also applicable to[client]
,[mysql]
and[mysqldump]
sections, add it there too.In this example, we are adding
max_allowed_packet
andwait_timeout
directives:[mysqld]
wait_timeout = 31536000
max_allowed_packet = 1024M
...
[mysqldump]
max_allowed_packet = 1024M -
Save the changes and close the file.
-
Restart the MySQL/MariaDB service:
# systemctl restart mysql || systemctl restart mariadb || systemctl restart mysqld
- Connect to Plesk server via RDP.
- Open the file
%plesk_dir%DatabasesMySQLmy.ini
in a text editor. -
Add your custom variables under the
[mysqld]
section. If the variable is also applicable to[client]
and[mysqldump]
sections, add it there too.In this example, we are adding
max_allowed_packet
andwait_timeout
:[mysqld]
wait_timeout = 31536000
max_allowed_packet = 1024M
...
[mysqldump]
max_allowed_packet = 1024M -
Save the changes and close the file.
-
Restart the MySQL/MariaDB service via Windows Services or Plesk Services Monitor.