Plesk

Unable to copy/back up a database in Plesk: mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table

Symptoms

Cause

The current limits in MySQL/MariaDB configuration are not enough for dumping the database.

Resolution

Increase the limits:

  1. Connect to the Plesk server via SSH.

  2. Open the MySQL/MariaDB configuration file my.cnf 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 the following lines under the [mysqld] section:

    innodb_buffer_pool_size=100M
    max_allowed_packet=1024M
    net_read_timeout=3600
    net_write_timeout=3600
    net_buffer_length = 64K
    [mysqldump]
    max_allowed_packet = 1024M

  4. Save the changes and close the file.

  5. Restart MySQL/MariaDB server using one of the commands below. The command depends on operating system and installed MySQL/MariaDB version:

    # service mysql restart

    # service mariadb restart