Plesk

Unable to remove a database in Plesk: This resource is used by installed web application

Symptoms

Cause

Database inconsistency.

Resolution

  1. Connect to the Plesk server via SSH (Linux) / RDP (Windows Server).

  2. Create a backup of the Plesk database:

    • on Linux, run the command:

      # plesk db dump psa > /root/psa_backup.sql

    • on Windows Server, start a command prompt as an Administrator and run the command:

      C:> plesk db dump psa > C:psa_backup.sql

  3. Connect to the Plesk database:

    plesk db

  4. Find ID of the subscription to which the affected domain belongs:

    mysql> select id from domains where name='example.com';
    +----+
    | id |
    +----+
    | 23 |
    +----+

  5. Find the connection ID between an application and a database using ID from the step 4:

    mysql> SELECT data_bases.name,apsResources.pleskId FROM `data_bases` INNER JOIN `DatabaseServers` ON data_bases.db_server_id = DatabaseServers.id LEFT JOIN `apsResources` ON apsResources.pleskId = data_bases.id AND apsResources.pleskType="db" WHERE (dom_id = 23);
    +------------+---------+
    | name       | pleskId |
    +------------+---------+
    | example_db |      17 |
    +------------+---------+

  6. Delete a connection record using pleskId from the step 5:

    mysql> DELETE FROM apsResources WHERE pleskType="db" AND pleskId=17;

  7. Remove the database Domains > example.com > Databases.