Plesk

Unable to repair MySQL using Plesk repair utility: Operation CREATE USER failed

Symptoms

Cause

Such user already exists or also it can be caused by the MySQL bug: https://bugs.mysql.com/bug.php?id=28331

Resolution

  1. Connect to the server using SSH.

  2. Create a dump of the database mysql:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin mysql > /root/mysql_db_backup_$(date "+%b-%d-%Y-%H-%M-%S").sql

  3. Access MySQL server and switch to the database mysql:

    # plesk db

    mysql> use mysql;

  4. Remove the user mentioned in the error message:

    mysql> DROP USER 'user'@'localhost';

  5. Flush privileges from MySQL:

    mysql> flush privileges;

  6. Try again the operation of repairing or user creation.

Additional information

Stack Overflow thread