MySQL 角色在 Delphi 应用程序中不起作用

MySQL roles don't work in a Delphi application

我将 MariaDB10 与 DBForge 一起使用并创建了一个 Delphi 项目,我创建了一个角色来管理权限,但效果不佳。

1 - 在 DbForge 面板上创建一个具有过程权限的角色 myprocedure

2 - 在我的 Delphi 项目中添加一个 Tmyquery,代码为 set default role myrole

3 - 在 afterConnect 上添加一个过程,调用创建的查询

4 - 在 MyConnection 选项上设置 disconnectedMode = true

有时这个过程有效,但大多数时候我收到错误:Acess denied to user XX for routine myprocedure

我尝试控制权限的例程、函数和表会发生这种情况

除此之外,每次我授予角色权限并在编辑程序后,角色都会失去我之前授予的权限

Obs:DbForge 面板上的角色工作正常,就在我试图将其放在 Delphi

上时

如果用户还没有访问该角色的权限,那么他们 运行 set default role myrole 不会将其授予他们。

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.