1

I am using MariaDB10 with DBForge and creating a Delphi Project, I created a role to manage the permissions but it's not working good.

1 - Create a role on DbForge panel with a permission for a procedure myprocedure

2 - Add a Tmyquery in my Delphi project with the code set default role myrole

3 - Add a procedure on afterConnect calling the query created

4 - Set disconnectedMode = true on MyConnection options

Sometimes this process works, but most times I receive an Error: Acess denied to user XX for routine myprocedure

This happens with routines, functions and tables that I try to control the permissions

Besides that every time that I give a permission on a role and after edit the procedure the role loses the permission that I gave before

Obs: The roles work okey on DbForge panel is just when I tried to put this on Delphi

BDuarte
  • 129
  • 11

1 Answers1

2

If the user doesn't already have access to that role then them running set default role myrole doesn't give it to them.

SET DEFAULT ROLE requires these privileges:

Setting the default roles for another user requires the global CREATE USER privilege, or the UPDATE privilege for the mysql.default_roles system table.

Setting the default roles for yourself requires no special privileges, as long as the roles you want as the default have been granted to you.

Brian
  • 6,717
  • 2
  • 23
  • 31
  • That quotes [MySQL 8.0](https://dev.mysql.com/doc/refman/8.0/en/set-default-role.html); for OP: [MariaDB 10.1.1](https://mariadb.com/kb/en/set-default-role/) – AmigoJack Sep 28 '20 at 14:52