• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.

Forwarded to devs Plesk command line : register existing user to database domain

jallon

New Pleskian
TITLE:
Plesk command line : register existing user to database domain
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:
Product version: Plesk Onyx 17.5.3 Update #20
Update date: 2017/08/29 03:09
Build date: 2017/03/17 16:00
OS version: CentOS 7
Revision: 55d1b49a272f44666e1920eca8b6e4da449a38cd
Architecture: 64-bit
Wrapper version: 1.2
PROBLEM DESCRIPTION:
I have created a mysql database and a mysql user with mysql cli
i have granted all privileges for the user to the database
I have registered the database to a plesk domain with plesk command line

Impossible to register the user in the plesk database​
STEPS TO REPRODUCE:
  • plesk interface
Create the domain mydomain in plesk
  • Mysql cli
Code:
CREATE DATABASE `mydb`;
Code:
CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'mypass';
Code:
GRANT ALL PRIVILEGES ON `mydb`.* TO 'dbuser'@'localhost' WITH GRANT OPTION;
  • plesk command line
Code:
plesk bin database --register mydb -domain mydomain -server localhost:3306
Code:
plesk bin database --register-dbuser dbuser -domain mydomain -type mysql -database mydb -passwd mypass
Result :
Database user with such login is already registered.
exit status 2
ACTUAL RESULT:
Code:
SELECT domains.name AS domain_name, data_bases.name AS database_name, db_users.login, accounts.password
FROM data_bases
left join db_users on db_users.db_id = data_bases.id
left join domains on domains.id = data_bases.dom_id
left join accounts on accounts.id = db_users.account_id
WHERE domains.name = 'mydomain';

Result :

+------------------+----------------+-------+----------+
| domain_name | database_name | login | password |
+------------------+----------------+-------+----------+
| mydomain | mydb | NULL | NULL |
+------------------+----------------+-------+----------+​
EXPECTED RESULT:
Code:
SELECT domains.name AS domain_name, data_bases.name AS database_name, db_users.login, accounts.password
FROM data_bases
left join db_users on db_users.db_id = data_bases.id
left join domains on domains.id = data_bases.dom_id
left join accounts on accounts.id = db_users.account_id
WHERE domains.name = 'mydomain';

Result :

+------------------+----------------+-------+----------+
| domain_name | database_name | login | password |
+------------------+----------------+-------+----------+
|mydomain | mydb | dbuser | xxxxxx |
+------------------+----------------+-------+----------+​
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Help with sorting out
 
Last edited:
From developers:

Cannot reproduce on 17.5.3 MU#22:

MariaDB [psa]> create database mydb;
Query OK, 1 row affected (0.02 sec)

MariaDB [psa]> create user myuser identified by 'mypass';
Query OK, 0 rows affected (0.05 sec)

MariaDB [psa]> grant all on mydb.* to myuser with grant option;
Query OK, 0 rows affected (0.00 sec)


# plesk bin database --register mydb -domain mydomain.tld -server localhost:3306
The database was successfully registered.

# plesk bin database --register-dbuser myuser -domain mydomain.tld -type mysql -database mydb -passwd mypass
The database user was successfully registered.
 
Cannot reproduce to if i manually create the domain in plesk interface but i reproduce with imported domain for another plesk server (version 12.5).
In the 12.5 server the database and user wasn't registered in plesk.
 
Back
Top