• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • Our UX team believes in the in the power of direct feedback and would like to invite you to participate in interviews, tests, and surveys.
    To stay in the loop and never miss an opportunity to share your thoughts, please subscribe to our UX research program. If you were previously part of the Plesk UX research program, please re-subscribe to continue receiving our invitations.
  • 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.

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