Symptoms
-
Unable to remove a database in Plesk:
- The option Remove Database is grayed out at Plesk > Domains > example.com > Databases.
- 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 at Tools & Settings > Database Server > Databases.
-
There is no application installed at Domains > example.com > Applications.
-
Unable to change a domain for the database in Plesk > Domains > example.com > Databases, there is no option to change the domain/subdomain that is related to a database.
Cause
Database inconsistency.
Resolution
-
Connect to the Plesk server via SSH (Linux) / RDP (Windows Server).
-
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
-
-
Connect to the Plesk database:
plesk db
-
Find ID of the subscription to which the affected domain belongs:
mysql> select id from domains where name='example.com';
+----+
| id |
+----+
| 23 |
+----+ -
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 |
+------------+---------+ -
Delete a connection record using
pleskId
from the step 5:mysql> DELETE FROM apsResources WHERE pleskType="db" AND pleskId=17;
-
Remove the database Domains > example.com > Databases.