Plesk

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

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.

 

For Plesk on Linux

 

  1. Connect to the Plesk server via SSH.
  2. 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

  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:

    [mysqld]
    wait_timeout = 31536000
    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 || systemctl restart mysqld

 

For Plesk on Windows Server

 

  1. Connect to Plesk server via RDP.
  2. Open the file %plesk_dir%DatabasesMySQLmy.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:

    [mysqld]
    wait_timeout = 31536000
    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.


 

 

 

Exit mobile version