Plesk Backup Fix Instructions

Error Summary

Plesk backups fail with errors like:

This happens because Plesk tries to connect to MariaDB using TCP (--host=localhost --port=3306) and a configuration file (--defaults-file=/etc/my.cnf) that conflicts with MariaDB’s socket-only mode (skip-networking).

Environment: AlmaLinux 8, MariaDB 10.11.12, Plesk 18.0.69.

Prerequisites

Ensure you have:

Fix Instructions

Step 1: Back Up Original Binary

Save the original mariadb-dump binary.

mv /usr/bin/mariadb-dump /usr/bin/mariadb-dump.orig

Step 2: Create Wrapper Script

Create a wrapper for mariadb-dump to use socket connections.

cat << 'EOF' > /usr/bin/mariadb-dump
#!/bin/bash
args=()
skip_next=false
for arg in "$@"; do
  if [ "$skip_next" = true ]; then
    skip_next=false
    continue
  fi
  if [[ "$arg" == "--defaults-file=/etc/my.cnf" || "$arg" == "--host=localhost" || "$arg" == "--port=3306" ]]; then
    skip_next=true
    continue
  fi
  if [[ "$arg" == --host=* || "$arg" == --port=* ]]; then
    continue
  fi
  args+=("$arg")
done
/usr/bin/mariadb-dump.orig --socket=/var/lib/mysql/mysql.sock --user=admin --password="$(cat /etc/psa/.psa.shadow)" "${args[@]}"
EOF
chmod 755 /usr/bin/mariadb-dump

Step 3: Test Plesk Backup

Run a test backup, replacing example.com with your domain.

/usr/local/psa/bin/pleskbackup --domains-name example.com -v

Expected: Backup completes with status="success".

Step 4: Back Up Wrapper

Save the wrapper to restore after MariaDB updates.

cp /usr/bin/mariadb-dump /root/mariadb-dump-wrapper.sh

Step 5: Document and Monitor

Add to system notes:

After MariaDB updates, check:

head -n 1 /usr/bin/mariadb-dump

If not #!/bin/bash, restore:

mv /usr/bin/mariadb-dump /usr/bin/mariadb-dump.bak
cp /root/mariadb-dump-wrapper.sh /usr/bin/mariadb-dump
chmod 755 /usr/bin/mariadb-dump

Next Steps

If the backup fails, contact Plesk support.