Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to customize MySQL variables (e.g. max_allowed_packet, read_buffer_size connect_timeout 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 your Plesk server via SSH.
- Open the my.cnf file in a text editor. In this example, we are using vi editor:
-
on CentOS/RHEL-based distributions:
# vi /etc/my.cnf
-
on Debian/Ubuntu-based distributions:
# vi /etc/mysql/my.cnf
-
-
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_packetandwait_timeoutdirectives:CONFIG_TEXT: [mysqld]
wait_timeout = 31536000
connect_timeout = 10
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
- Connect to your Plesk server via RDP.
- Open the file
%plesk_dir%Databases\MySQL\my.iniin 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_packetandwait_timeout:CONFIG_TEXT: [mysqld]
wait_timeout = 31536000
connect_timeout = 10
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.
Comments
Please sign in to leave a comment.