Articles in this section

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

kb: bug Plesk Onyx for Linux ABT: Group B

Applicable to:

  • Plesk Onyx for Linux

Symptoms

  • Unable to migrate a database in Tools & Settings > Migration & Transfer Manager > source server or via Site import extension, when a database username has more than 16 characters:

    PLESK_ERROR: Unable to create database user 'usernamewith16characters' in subscription 'example.com': Command execution failed on the local server with non-zero exit code.
    command: /usr/local/psa/bin/database --create-dbuser usernamewith16characters -passwd '' -domain example.com -any-database -type mysql -server localhost:3306 -ignore-nonexistent-options
    exit code: 1
    stdout:
    stderr: Unable to add database user: Database user name is invalid.

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 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.