• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question How to assign a database to a site by command line? Seems --assign-to-subscription not working as it

nethubonline

Regular Pleskian
Hi all,

I want to use command line to assign a database to a site, just like the screenshot below:
screenshot-1169.jpg

screenshot-1170.jpg


According to this doc database: Databases , I tried to run command
Code:
plesk bin database --assign-to-subscription test1 -domain test1.com -server localhost:3306
, but seems it is not I want and I cannot find what it updated.

Is there any command that I can use command line to assign a database to a site?
 
I assume that this cannot be reached by some command line utility. It is the question of database records. This SQL query lists all databases that have the option "Related to" defined in Plesk. If it is not set, database will not appear in the list. Please note that this query does not list databases that were created together with applications via the Plesk Applications menu.

mysql> select db.name as "Database", d.name as "Related to" from data_bases db, domains d, dom_param p where d.id=p.dom_id and p.val=db.id and p.param='lastDatabaseSelectedId';

The output will look as follows:

+----------------+-------------+
| Database | Related to |
+----------------+-------------+
| db_example.com | example.com |
| db_example.net | example.net |
+----------------+-------------+

Maybe a modification of lastDatabaseSelectedId parameter in dom_param table will help you, but please be careful with any direct database modifications.
 
May I know what will --assign-to-subscription do?
The database may be not assigned, just registered, because it can be created not via Plesk. For using such a database in the scope of subscription, you need to assign it first.
 
Back
Top