• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Plesk command line register existing user to domain

jallon

New Pleskian
I have register an existing databases to a new domain on plesk 17.

In plesk database domain i have the message :

  • No database user

It's normal because i have creating the user with sql script.

To register the existing user, i use this command :

  • plesk bin database --register-dbuser dbuser -domain example.com -database sampledb -type mysql -user-role readWrite -passwd dbpass

But i have an error :

  • Database user with such login is already registered.

How can i do ?
 
Hi jallon,

to register an already existing database for a domain, you could use the example command:
Code:
plesk bin database --register sampledb -domain example.com -server localhost:3306

... or if you would like to assign an existing database to a specific subscription, owning the domain "example.com", you could use the example command:
Code:
plesk bin database --assign-to-subscription jdoe-gallery -domain example.com -server localhost:3306



Further Plesk CLI - commands are as well documented at the official Plesk documentation:

 
Yes, thank you but i have already registered my database with the command you write.

What i want is to assign the user of the database (he already as all grant options to the database) in plesk because in plesk i see :
  • No database user
 
Hi jallon,

I already posted the link to the official documentation above. Pls. be so kind to read the additional, possible command options, when you use the Plesk CLI commands:
Code:
plesk bin database ...
 
I am sorry but I have read the documentation several times and I conclude that it is impossible to register an already existing mysql database user on a database of a plesk domain.
 
Hi jallon,

Database user with such login is already registered
and I conclude that it is impossible to register an already existing mysql database user on a database of a plesk domain
To check your current registered databases and the corresponding registered usernames at the psa database, you are able to use the example commands ( logged in as user "root" over SSH ):
Code:
mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa
followed by
Code:
SELECT domains.name AS domain_name, data_bases.name AS database_name, db_users.login, accounts.password FROM data_bases, db_users, domains, accounts WHERE data_bases.dom_id = domains.id AND db_users.db_id = data_bases.id AND db_users.account_id = accounts.id ORDER BY domain_name;
 
This request is better to check :

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
ORDER BY domain_name;

The line for the domain on which I want to registered the user have a database but null value in login and password
 
Thank you. I have forwarded your report to developers.
 
Back
Top