Bobcares

How to Configure max_allowed_packet in Plesk

by | Feb 21, 2025

Learn all about max_allowed_packet in MySQL and how to configure it in Plesk. Our Plesk Support team is here to help you with your questions and concerns.

How to Configure max_allowed_packet in Plesk

How to Configure max_allowed_packet in PleskMySQL’s max_allowed_packet sets the upper limit for a single message size between the MySQL server and its clients, including replicas.

According to our Experts, this parameter plays a key role in database operations, particularly when dealing with large data types like TEXT or BLOB columns.

If we’re using Plesk, we can check the current max_allowed_packet value using different methods.

Method 1: MySQL Command Line

  1. Connect to the Plesk server via SSH.
  2. Log into MySQL using the following command:

    mysql -u root -p

  3. Run the SQL command to check the current value:

    SHOW VARIABLES LIKE 'max_allowed_packet';

  4. The result will display the current max_allowed_packet value.

Method 2: Using a PHP Script

We can also retrieve this value using a simple PHP script:


<?php
$connection = mysqli_connect('localhost', 'username', 'password');
$max_packet_size = mysqli_query($connection, "SELECT @@max_allowed_packet");
$result = mysqli_fetch_array($max_packet_size);
echo "Max Allowed Packet: " . $result[0] . " bytes";
?>

Method 3: Checking Configuration Files

For Linux-based Plesk servers, inspect the configuration files:

  • /etc/my.cnf
  • /etc/mysql/my.cnf

For Windows-based Plesk servers, check:

`%plesk_dir%\Databases\MySQL\my.ini

To verify via the command line, run:

mysqladmin variables | grep max_allowed_packet

<h4How to Modify max_allowed_packet in Plesk

The default value is typically 16MB, but this can vary based on our MySQL/MariaDB version. The maximum value allowed is 1GB (1073741824 bytes or 1024M).

For Linux-based Plesk Servers

  1. Access the Plesk server via SSH as root.
  2. Then, open the MySQL configuration file using a text editor:


    vi /etc/my.cnf # For CentOS/RHEL
    vi /etc/mysql/my.cnf # For Debian/Ubuntu

  3. Then, add or modify the max_allowed_packet variable under the [mysqld] and [mysqldump] sections:


    [mysqld]
    max_allowed_packet = 1024M
    [mysqldump]
    max_allowed_packet = 1024M

  4. Restart MySQL

    systemctl restart mysql || systemctl restart mariadb || systemctl restart mysqld

For Windows-based Plesk Servers:

  1. Open the file at the default Plesk MySQL configuration location:

    %plesk_dir%\Databases\MySQL\my.ini

    Default path: `C:\Program Files (x86)\Parallels\Plesk\Databases\MySQL\data\my.ini`

  2. Then, add or update the max_allowed_packet setting:


    [mysqld]
    max_allowed_packet = 1024M
    [mysqldump]
    max_allowed_packet = 1024M

  3. Use Windows Services Manager or Plesk Services Monitor to restart MySQL/MariaDB.

Important Reminders

  • Increasing max_allowed_packet allows larger data transmissions but can consume more memory, leading to potential slowdowns on resource-limited servers.
  • Setting a very high value may destabilize MySQL, especially in shared hosting environments.
  • Large packet sizes may introduce buffer overflow vulnerabilities or expose the database to data corruption risks.
  • Different MySQL/MariaDB versions enforce varying limits, so verify compatibility before modifying this parameter.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

Configuring max_allowed_packet in MySQL through Plesk helps handle large data transmissions efficiently. However, improper tuning can lead to performance degradation, security risks, and system instability.

In brief, our Support Experts introduced us to max_allowed_packet in MySQL and hshowed us ow to configure it in Plesk.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF