Articles in this section

How to customize MySQL/MariaDB variables on a Plesk server?

Plesk for Windows kb: how-to Plesk for Linux ABT: Group A

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.

For Plesk on Linux
  1. Connect to your Plesk server via SSH.
  2. 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

  3. 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 and wait_timeout directives:

    CONFIG_TEXT: [mysqld]
    wait_timeout = 31536000
    connect_timeout = 10
    max_allowed_packet = 1024M
    ...
    [mysqldump]
    max_allowed_packet = 1024M

  4. Save the changes and close the file.
  5. Restart the MySQL/MariaDB service:

    # systemctl restart mysql || systemctl restart mariadb

For Plesk on Windows Server
  1. Connect to your Plesk server via RDP.
  2. Open the file %plesk_dir%Databases\MySQL\my.ini in a text editor.
  3. 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 and wait_timeout:

    CONFIG_TEXT: [mysqld]
    wait_timeout = 31536000
    connect_timeout = 10
    max_allowed_packet = 1024M
    ...
    [mysqldump]
    max_allowed_packet = 1024M

  4. Save the changes and close the file.
  5. Restart the MySQL/MariaDB service via Windows Services or Plesk Services Monitor.


    mceclip0.png
     

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.