Page 1 of 1

User specific database without merging with root databases

PostPosted: 01. September 2018 21:57
by optimisticwalker
Switched to XAMPP after a long time again.

MySql database created by the root user with Database-specific privileges for a sub-user won't allow the sub-user to create a new database from that sub account :( . Only table operations are allowed in this case.


On the other hand database created by the root user with Global privileges or both Global privileges & Database-specific privileges for a sub-user allows sub-user to create database from that sub-account.

The problem is that both the sub-user account and database created with such privileges are merged with root user account and is treated as root account with specific given privileges by the root user.


Is there a way to create MySql database from a sub-user's account that has been granted Database-specific privileges only by the root user?

Re: User specific database without merging with root databas

PostPosted: 02. September 2018 20:16
by Altrea
:!: :?:
Creating databases is a global permission, so the user who should be able to create a database cannot have database specific permissions only.

Re: User specific database without merging with root databas

PostPosted: 03. September 2018 11:02
by Nobbie
The Data Model of MySQL does not know "sub-users". There are only users and priviledges. What are you quoting there?

Re: User specific database without merging with root databas

PostPosted: 06. September 2018 20:17
by optimisticwalker
In fact I started using root level database after a long time. Yes that's the truth that users with global privilege can't obtain user specific database rather they shall have access to all databases. However, I came up with granting database specific privilege for multiple databases to the desired single user or multiple users as I did long ago.

Thanks,

Re: User specific database without merging with root databas

PostPosted: 06. September 2018 21:10
by Altrea
Altrea wrote::!: :?:
Creating databases is a global permission, so the user who should be able to create a database cannot have database specific permissions only.

I have learned something new today.

In fact it IS possible, to grant database specific permissions to a user INCLUDING creating databases.
Code: Select all
GRANT ALL PRIVILEGES ON `testuser\_%` .  * TO 'testuser'@'%';

This will grant the user the permission to create new databases starting with testuser_
If the user tries to create databases not starting with testuser_ it will get denied by error #1044.