Creating new database user fails. Connection to the database server has failed because of a name clash

Created:

2016-11-16 13:16:03 UTC

Modified:

2017-08-08 13:44:40 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Creating new database user fails. Connection to the database server has failed because of a name clash

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 12.0 for Windows

Symptoms

Creating a new database user for domain fails with error:

    Error: Connection to the database server has failed because of a name clash: User with requested name already exists

Cause

MySQL database inconsistency

Resolution

  1. Make sure that this user is not used by any other subscriptions.

  2. Backup MySQL database:

    "%plesk_dir%"\\Mysql\\bin\\mysqldump.exe -uadmin -p<plesk_admin_password> -P8306 mysql > backup_name.sql
  3. Login into mysql database.

    "%plesk_dir%"\\MySQL\\bin\\mysql.exe -uadmin -p<password> -P3306 mysql
  4. Check for the respective database users which your trying to add in Plesk.

    mysql> select * from user where user='username_1';
  5. If the db users name exist in MySQL db, rename those users manually.

    mysql> begin;
    mysql> UPDATE mysql`.`user` SET `user`.`User` = 'username_conflicted' WHERE `user`.`Host` = '%' AND `user`.`User` = 'username_1';
    mysql> commit;

    or delete

    mysql> begin;
    mysql> DELETE FROM `mysql`.`user` WHERE `user`.`Host` = '%' AND `user`.`User` = 'username_1';
    mysql> commit;
  6. Retry to add DB user trough Plesk Web Interface.

Have more questions? Submit a request
Please sign in to leave a comment.