Plesk

Migration or Site import fails: Unable to add database user: Database user name is invalid

Symptoms

Cause

The issue is considered as a Plesk bug with id #PPM-1889 which is already fixed in Plesk Obsidian.

Resolution

Upgrade to Plesk Obsidian to use up to 32 characters in MySQL 5.7 or up to 80 characters in MariaDB 10.0 and higher versions:

As a workaround:

For site import

  1. Connect to the server via SSH;

  2. Upload the attached patched file and extract it:

    # wget https://support.plesk.com/hc/en-us/article_attachments/115000725194/Checker.zip
    # unzip Checker.zip

  3. Backup original file:

    # mv /usr/local/psa/admin/plib/Checker.php{,.bak}

  4. Replace original file with the fixed one:

    # mv Checker.php /usr/local/psa/admin/plib/

  5. Re-migrate databases.

    Note: The fix works only for site import. It still will not be possible to create database user with the name containing more than 16 characters.

For the migration

Workaround 1. Change database username on the source server so it will contain 16 characters or less.

Workaround 2. If MariaDB version is less then 10.0 installed on the target server, consider upgrading it:
How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.0/10.1/10.2 on Linux