How to set/create db user & permissions ?

most of my scenarios has
One DB user for each website
(in additional to “root”).

When a vhsot is created, then VirtualMin creates DB-user & DB-passwodrd.

where Can i find the newly-created DB-password?
is there a way to set the new user permisions to the DB

Thanks!

By default, new virtual servers get a database with a preset name, and the administrative user of the vserver (whose password you enter when creating the vserver) gets access to that and all subsequently created databases.

Furthermore, you can assign (additionally created) regular users of the vserver access to its databases, in the Edit User screen under “Other user permissions”.

By default, new virtual servers get a database with a preset name, and the administrative user of the vserver (whose password you enter when creating the vserver) gets access to that and all subsequently created databases.

Furthermore, you can assign (additionally created) regular users of the vserver access to its databases, in the Edit User screen under “Other user permissions”.

Actually, it is recommended to create a dedicated regular user for database access. Because if you use the vserver’s administrative user, or even the root user, to access the DB, and have to put those credentials into a configuration file of web software you install, you open up a security risk to compromise the vserver, or even the whole host, if a hacker gains access to that configuration file.

Gaining access to a config file through insecure PHP code is usually much easier for badguys than hacking the SSH account of a vserver’s administrative user, or the root user. So if you use a dedicated database user, all the hacker can do if he gains access to the config file is doing bad stuff with the database. The vserver and host themselves remain safe though, in terms of FTP/SSH access.

After creating the Virtual-Server, I went to “Edit Databases --> Passwords --> Show…”

It is not by any way similar to any password that I entered.

It looks like a random password chosen by Virtualmin during the process.

Now that I know the password,
I could login to mysql (mysql -u USERNAME -pPASSWORD DBNAME),
And I also saw that

So functionality is OK, but for me there’s an issue of User Interface:

  • I didn’t know where this function is,
  • i thought it’s the same as the virtual-server’s admin.

For choosing a db-password, I would expect either or all of these options:

  • either be shown the random password during server creation gui,
  • or, set a DB password manually for that user,
  • or, set a default in the template.
  • or, use the same password as the virtualmin-admin (but as we both agree, this option is discouraged).

personally,
i think that this option should be set in the server-template, as a radio buttons for all the options i entered above.

btw:
in Webmin, the GUI for mysql permissions per user are totally unclear to me:
in what screen we’re suppose to view/edit individial permissions per db & user?

thanks!

Oh, that’s interesting. I don’t really know where this Custom Password is coming from, maybe it is auto-generated. I myself have only worked with the other option, “Same as administration password”, so far. It’s possible that the Template settings in the “MySQL databases” section have something to do with that, namely the “Keep … in sync” options. I have those set to “Yes” here.

As I explained, when you add further users to a virtual server, in the Virtualmin’s Edit Users screen (not in Webmin!), you can assign them access to individual databases under the “Other User Permissions” block.

in virtualmin -> “Edit User” -> “Other User Permissions”
the “drop-down” doesn’t open. see the arrow indicator next to it on the screenshot.
I reported it here https://www.virtualmin.com/node/26698

My original problem is not solved yet, and what i just wrote seems to be a new and irrelevant issue.

For those who’re interested in my case: I make myself a habit:

  1. after creating a virtual-server
  2. go manually to “databases”
  3. set a DB password manually.

It’s a bit annoying, especially if i forget to do that, which forces me to log back to virtualmin later only for that purpose.)