Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Plesk - Cannot remove database from domain  (Read 2711 times)

0 Members and 1 Guest are viewing this topic.

vinayakk

  • Guest
Plesk - Cannot remove database from domain
« on: January 08, 2014, 06:48:11 am »
In the Plesk panel , when removing a database the check-box next to the database name is grayed out and the database name contains :-This resource is used by the installed site application.

The issue is caused whenever the database is used by an installed site application. It can be removed only along with the respective site application.

To remove the database, the parent application needs to be removed from Plesk as well: Plesk > Domains > example.com > Applications

If no applications that may be using the database are displayed, the database needs to be marked as not belonging to any application, using the provided steps below. This problem could have arisen due to errors when deleting a site application.

1. Find the domain ID in the Plesk database:

set @dom_id = (select id from domains where name='example.com');

2. Find connection ID between the application and the database:

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 = @dom_id)\G


*************************** 1. row ***************************
            name: database_user123werjkdsfuo
            pleskId: 23

3. Delete the connection using "pleskId" found on previous step:

delete from apsResources where pleskType="db" and pleskId=23;

4. Remove the database using Plesk > Domains > example.com > Databases.

 :)