Where to set mysql-permissions (e.g. create Table...) per VirtualServer?

SYSTEM INFORMATION
OS type and version Ubuntu Linux 20.04.5
Webmin version 2.020
Usermin version 1.861
Virtualmin version 7.5
Theme version 20.20.1
Package updates All installed packages are up to date

I wonder where to set the permissions for a user, that he can act on his database in general way:
Select, Create Table, etc.

I didn’t found any section to edit this in the User’s VM menu. Only thing I’ve found was on Webmin > Servers > Mysql > User Permission.

But there, any user at the server don’t have any permissions to do something in their mysql-databases:

Shouldn’t be any user have some default-permissions to be able to use this database?
How can I setup this, for each new User?

@suther,

You manage this through Virtualmin side of panel not Webmin.

Domain owners can access a database via “Edit Databases”.

Other users created through “Edit Users” can be assigned access to a database through “Other user permissions” section.

The default user created with the ‘database’ and set in virtualmin has grant everything. Additional users can be given access but they are also GRANT everything. VM allows you to execute SQL as that user, so using that you can create additional users with CREATE USER X@Y IDENTIFIED BY… and so on, then grant permissions GRANT whatever_permissions ON X@Y IDENTIFIED BY… The syntax is fairly basic and with this you can lock users down to just certain tables or actions (like SELECT only but not UPDATE etc). MySQL Docs are a good place to start for this.

Example

GRANT Update ON TABLE COMPANIESTOmyuser@10.1.%;

Hope that gets you what you need.

@tpnsolutions thanks, I created a new user to test this:

But if I login (into the installed phpmyadimn) I’m don’t have the needed Permissions (as @GENLTD told…GRANT everything) on that DB

If I had a look in webmin-user-permission for this user, it also looks like he isn’t allowed to do anything:

What is my issue here?

@suther,

I won’t comment on others suggestions especially when the suggestion I made is the Virtualmin way…

Anyways, what error is the user getting when you give them access to the database?

I think this may be a phpmyadmin issue because when I assign a user to a database it does indeed get…

GRANT USAGE ON *.* TO `user@domain.uk`@`localhost` IDENTIFIED BY PASSWORD '*'
GRANT ALL PRIVILEGES ON `user`.* TO `user@domain.uk`@`localhost` WITH GRANT OPTION

I have of course obfuscated the actual user, but it does what it should do. Fine tuning those access rights will need the user of either an additional tool, or using the GRANT option. (And fwiw, limiting access to just what is needed is the correct way, but on a server where everything is only @‘localhost’ its not as critical as a server exposed to the outside world)

@tpnsolutions I only showed the screenshot of “webmin-section” as this is the only visual place I know in Virtualmin/Webmin which seems to indicate, that the user don’t have any permissions.

If I edit the user in the Webmin-Section and give im permissions like Create-Table, then it also work in phpmyadmin.

If I got you right, it would be enough to go to Edit Users and Grant access to database, like shown in my screenshot above?
I wonder why this only allow to access the db (means login via phpmyadmin) but don’t be able to doing anything.

@GENLTD I think something is wrong with my configuration. I can not believe, that I need to do some complicated steps to only let the user do stuff like select, create, etc. at their database after creating them.

I have to be honest I’m not sure what the operation of adding users via Webmin is going to be on the configuration in Virtualmin, but if you add the users in Virtualmin, it should (and does for me) grant them everything in that database. Whichever way you do it, just make sure you keep it secure, strong passwords and always @localhost.

Good Luck.

@suther,

Adding the permission to a “user” added through “edit users” should grant “all” permissions, not just read only as far as I’m aware.

Managing anything via the Webmin modules is for advanced use and cares where the Virtualmin module doesn’t handle the task.

Ex. Managing a service not controlled by Virtualmin but has a Webmin module.

@GENLTD, we appreciate the assistance being offered however let’s make sure to guide people through Virtualmin options before suggesting Webmin options as not unintentionally mislead or confuse users.

I apologise, I didn’t realise you were Virtualmin staff, it should be made clearer I think. I assure you I shall contribute no more and leave the public forum for the staff to handle, I didn’t realise this was how it worked sorry.

@GENLTD,

No, that’s not what I was saying. You are welcome to, and we do encourage discussion within the forums. What I meant is, we want to try to steer people to using a solution that works with Virtualmin first before doing it within the Webmin modules directly. This ensures that the solution works with Virtualmin as intended.

As noted, there is a Virtualmin way to accomplish the task, and we recommend this method “first”. Working with the Webmin modules directly should only generally be done if the task cannot be done within Virtualmin and by those with a bit more understanding of what they are doing.

In this case, setting up users, and assigning permissions to a database can be done within Virtualmin and for the most part would/should accomplish what was intended.

Don’t be discouraged, and I apologize if you read into my response as a negative. It was meant more as constructive in nature.

Don’t quit. Plesae, go on with contributing via the Forum.
I (and I think I also can say WE) appreciate your support und your helping hands.

Your suggestions are also good and give some deeper insights to the mysql permission system.
I think beside the usage of GUI, questions are very often also related to the “behind the scene working”.

Stay with us… we need you! :bouquet:

I found the issue.

I’m ashamed of such a stupid mistake, but maybe it will help someone else who has a similar problem later:

My issue was, that the Create-Command used a wrong Database-Name in the SQL-Import-Statement.
image

I didn’t noticed, that the table-name was part of the create-statement. What a stupid beginner mistake :frowning:

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.