• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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