Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to assign multiple database users to another database?  (Read 3514 times)

0 Members and 2 Guests are viewing this topic.

vichithrakumart

  • Guest
How to assign multiple database users to another database?
« on: August 12, 2018, 03:53:08 pm »
You can use database utility to add the user to the existing database:

Code: [Select]
# plesk bin database --update <db_name> -add_user <db_user> -passwd <password>
Code: [Select]
db_name1 db_user1 password1
db_name2 db_user2 password2
db_name3 db_user3 password3


The 1st column is database name on the database server where it is required to add database user.
The 2nd column is a name of a database user.
The 3rd column is a password of a database user.

After this, connect to the server via SSH and run the utility in a loop taking the data from /root/db_user.list file:
Code: [Select]
# cat /root/db_user.list | while read var1 var2 var3 ; do plesk bin database --update $var1 -add_user $var2 -passwd $var3 ; echo user $var2 - success; done